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

Provides a fake http response. More...

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

Public Member Functions

override void OnStarting (Func< object, Task > callback, object state)
override void OnCompleted (Func< object, Task > callback, object state)
override void Redirect (string location, bool permanent)
void SetContextAccessor (Func< HttpContext > accessor)
 Set the http context accessor.
void SetHeaders (IHeaderDictionary headers)
 Set the response headers collection.
void SetCookies (IResponseCookies cookies)
 Set the cookies collection.
void AddOnStartingHandler (Action< Func< object, Task >, object > handler)
 Add a handler for when the request is starting.
void AddOnCompletedHandler (Action< Func< object, Task >, object > handler)
 Add a handler for when the request is completed.
void AddRedirectHandler (Action< string, bool > handler)
 Add a handler for when the request is redirected.
void SetHasStarted (bool hasStarted)
 Set the HasStarted property.
override Task CompleteAsync ()
 Does nothing.
override Task StartAsync (CancellationToken cancellationToken=new CancellationToken())
 Does nothing, really.

Static Public Attributes

const string DEFAULT_CONTENT_TYPE = "text/html"
 The default content type for a response.

Properties

override HttpContext HttpContext [get]
override int StatusCode [get, set]
override IHeaderDictionary Headers [get]
override Stream Body [get, set]
override? long ContentLength [get, set]
override string ContentType = DEFAULT_CONTENT_TYPE [get, set]
override IResponseCookies Cookies [get]
override bool HasStarted [get]
override PipeWriter BodyWriter [get]

Detailed Description

Provides a fake http response.

Member Function Documentation

◆ AddOnCompletedHandler()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.AddOnCompletedHandler ( Action< Func< object, Task >, object > handler)

Add a handler for when the request is completed.

Parameters
handler

◆ AddOnStartingHandler()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.AddOnStartingHandler ( Action< Func< object, Task >, object > handler)

Add a handler for when the request is starting.

Parameters
handler

◆ AddRedirectHandler()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.AddRedirectHandler ( Action< string, bool > handler)

Add a handler for when the request is redirected.

Parameters
handler

◆ CompleteAsync()

override Task PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.CompleteAsync ( )

Does nothing.

Returns

◆ SetContextAccessor()

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

Set the http context accessor.

Parameters
accessor

◆ SetCookies()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.SetCookies ( IResponseCookies cookies)

Set the cookies collection.

Parameters
cookies

◆ SetHasStarted()

void PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.SetHasStarted ( bool hasStarted)

Set the HasStarted property.

Parameters
hasStarted

◆ SetHeaders()

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

Set the response headers collection.

Parameters
headers

◆ StartAsync()

override Task PeanutButter.TestUtils.AspNetCore.Fakes.FakeHttpResponse.StartAsync ( CancellationToken cancellationToken = new CancellationToken())

Does nothing, really.

Parameters
cancellationToken
Returns

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