Table of Contents

Class VirtualResponse

Namespace
AngleSharp.Io
Assembly
AngleSharp.dll

The virtual response class.

public class VirtualResponse : IResponse, IDisposable
Inheritance
VirtualResponse
Implements
Inherited Members
Extension Methods

Methods

Address(Url)

Sets the location of the response to the given url.

public VirtualResponse Address(Url url)

Parameters

url Url

The imaginary url of the response.

Returns

VirtualResponse

The current instance.

Address(string)

Sets the location of the response to the provided address.

public VirtualResponse Address(string address)

Parameters

address string

The string to use as an url.

Returns

VirtualResponse

The current instance.

Address(Uri)

Sets the location of the response to the uri's value.

public VirtualResponse Address(Uri url)

Parameters

url Uri

The Uri instance to convert.

Returns

VirtualResponse

The current instance.

Content(Stream, bool)

Sets the response's content from the provided stream.

public VirtualResponse Content(Stream stream, bool shouldDispose = false)

Parameters

stream Stream

The response's content stream.

shouldDispose bool

True to dispose afterwards.

Returns

VirtualResponse

The current instance.

Content(string)

Sets the response's content from the provided string.

public VirtualResponse Content(string text)

Parameters

text string

The text to use as content.

Returns

VirtualResponse

The current instance.

Sets the value of the cookie associated with the response.

public VirtualResponse Cookie(string value)

Parameters

value string

The cookie's value.

Returns

VirtualResponse

The current instance.

Create(Action<VirtualResponse>)

Creates a new virtual response.

public static IResponse Create(Action<VirtualResponse> request)

Parameters

request Action<VirtualResponse>

The request callback.

Returns

IResponse

The resulted response.

Header(string, string)

Sets the header with the given name and value.

public VirtualResponse Header(string name, string value)

Parameters

name string

The header name to set.

value string

The value for the key.

Returns

VirtualResponse

The current instance.

Headers(IDictionary<string, string>)

Sets the headers with the name of the keys and their assigned values.

public VirtualResponse Headers(IDictionary<string, string> headers)

Parameters

headers IDictionary<string, string>

The dictionary to use.

Returns

VirtualResponse

The current instance.

Headers(object)

Sets the headers with the name of the properties and their assigned values.

public VirtualResponse Headers(object obj)

Parameters

obj object

The object to decompose.

Returns

VirtualResponse

The current instance.

Status(int)

Sets the status code by providing the integer value.

public VirtualResponse Status(int code)

Parameters

code int

The integer representing the code.

Returns

VirtualResponse

The current instance.

Status(HttpStatusCode)

Sets the status code.

public VirtualResponse Status(HttpStatusCode code)

Parameters

code HttpStatusCode

The status code to set.

Returns

VirtualResponse

The current instance.