PeanutButter
Loading...
Searching...
No Matches
PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest Class Reference

Implements a fake http request. More...

Inheritance diagram for PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest:
PeanutButter.TestUtils.AspNetCore.Fakes.IFake

Public Member Functions

override Task< IFormCollection > ReadFormAsync (CancellationToken cancellationToken=new CancellationToken())
 FakeHttpRequest ()
void SetContext (HttpContext context)
 Sets the http context for the request.
void SetContextAccessor (Func< HttpContext > accessor)
 Sets the http context accessor for the request.
void SetHeaders (IHeaderDictionary headers)
 Sets the headers collection for the request.
void SetUrl (string url)
 Sets the url components on this request from the provided Url.
void SetUrl (Uri url)
 Sets the url components on this request from the provided Url.

Properties

override HttpContext HttpContext [get]
override string Method [get, set]
override string Scheme [get, set]
override bool IsHttps [get, set]
override HostString Host = new("localhost") [get, set]
override PathString PathBase = new("") [get, set]
override PathString Path = new("/") [get, set]
override QueryString QueryString [get, set]
override IQueryCollection Query [get, set]
override string Protocol [get, set]
override IHeaderDictionary Headers [get]
override IRequestCookieCollection Cookies [get, set]
override? long ContentLength = new FakeRequestCookieCollection() [get, set]
override string ContentType [get, set]
override Stream Body [get, set]
override bool HasFormContentType [get]
override IFormCollection Form [get, set]
bool ContentIsJson [get]
 Flag: returns true if the body can be deserialized as json.

Detailed Description

Implements a fake http request.

Member Function Documentation

◆ SetContext()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest.SetContext ( HttpContext context)

Sets the http context for the request.

Parameters
context

◆ SetContextAccessor()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest.SetContextAccessor ( Func< HttpContext > accessor)

Sets the http context accessor for the request.

Parameters
accessor

◆ SetHeaders()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest.SetHeaders ( IHeaderDictionary headers)

Sets the headers collection for the request.

Parameters
headers

◆ SetUrl() [1/2]

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest.SetUrl ( string url)

Sets the url components on this request from the provided Url.

Parameters
url

◆ SetUrl() [2/2]

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpRequest.SetUrl ( Uri url)

Sets the url components on this request from the provided Url.

Parameters
url

The documentation for this class was generated from the following file:
  • source/TestUtils/PeanutButter.TestUtils.AspNetCore/Fakes/FakeHttpRequest.cs