Docs · API reference · Motus.Abstractions

IResponse Interface#

Represents an HTTP response received by the page.

public interface IResponse

Properties#

Frame Property#

Gets the frame that initiated the request for this response.

Motus.Abstractions.IFrame Frame { get; }

Property Value#

IFrame

Headers Property#

Gets the response headers.

Motus.Abstractions.IHeaderCollection Headers { get; }

Property Value#

IHeaderCollection

Ok Property#

Gets whether the response status code is in the 200-299 range.

bool Ok { get; }

Property Value#

System.Boolean

Request Property#

Gets the request that generated this response.

Motus.Abstractions.IRequest Request { get; }

Property Value#

IRequest

Status Property#

Gets the HTTP status code of the response.

int Status { get; }

Property Value#

System.Int32

StatusText Property#

Gets the HTTP status text of the response.

string StatusText { get; }

Property Value#

System.String

Url Property#

Gets the URL of the response.

string Url { get; }

Property Value#

System.String

Methods#

BodyAsync(CancellationToken) Method#

Returns the response body as a byte array.

System.Threading.Tasks.Task<byte[]> BodyAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters#

ct System.Threading.CancellationToken

Cancellation token.

Returns#

System.Threading.Tasks.Task<System.Byte[]>
The response body bytes.

JsonAsync<T>(CancellationToken) Method#

Deserializes the response body as JSON.

System.Threading.Tasks.Task<T> JsonAsync<T>(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Type parameters#

T

The expected deserialized type.

Parameters#

ct System.Threading.CancellationToken

Cancellation token.

Returns#

System.Threading.Tasks.Task<T>
The deserialized object.

TextAsync(CancellationToken) Method#

Returns the response body as text.

System.Threading.Tasks.Task<string> TextAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters#

ct System.Threading.CancellationToken

Cancellation token.

Returns#

System.Threading.Tasks.Task<System.String>
The response body text.