Table of Contents

Class Response<TRequest>

Namespace
PuppeteerSharp
Assembly
PuppeteerSharp.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

public abstract class Response<TRequest> : IResponse where TRequest : IRequest

Type Parameters

TRequest
Inheritance
Response<TRequest>
Implements
Derived

Properties

Frame

A Frame that initiated this request. Or null if navigating to error pages.

public IFrame Frame { get; }

Property Value

IFrame

FromCache

True if the response was served from either the browser's disk cache or memory cache.

public abstract bool FromCache { get; }

Property Value

bool

FromServiceWorker

Gets a value indicating whether the IResponse was served by a service worker.

public bool FromServiceWorker { get; protected init; }

Property Value

bool

true if the IResponse was served by a service worker; otherwise, false.

Headers

An object with HTTP headers associated with the response. All header names are lower-case.

public Dictionary<string, string> Headers { get; protected init; }

Property Value

Dictionary<string, string>

The headers.

Ok

Contains a boolean stating whether the response was successful (status in the range 200-299) or not.

public bool Ok { get; }

Property Value

bool

true if ok; otherwise, false.

RemoteAddress

Remove server address.

public RemoteAddress RemoteAddress { get; protected init; }

Property Value

RemoteAddress

Request

protected TRequest Request { get; init; }

Property Value

TRequest

SecurityDetails

Gets or sets the security details.

public SecurityDetails SecurityDetails { get; protected init; }

Property Value

SecurityDetails

The security details.

Status

Contains the status code of the response.

public HttpStatusCode Status { get; protected init; }

Property Value

HttpStatusCode

The status.

StatusText

Contains the status text of the response (e.g. usually an "OK" for a success).

public string StatusText { get; protected init; }

Property Value

string

The status text.

Url

Contains the URL of the response.

public string Url { get; protected init; }

Property Value

string

Methods

BufferAsync()

Returns a Task which resolves to a buffer with response body.

public abstract ValueTask<byte[]> BufferAsync()

Returns

ValueTask<byte[]>

A Task which resolves to a buffer with response body.

JsonAsync()

Returns a Task which resolves to a JObject representation of response body.

public Task<JObject> JsonAsync()

Returns

Task<JObject>

A Task which resolves to a JObject representation of response body.

See Also

JsonAsync<T>()

Returns a Task which resolves to a T representation of response body.

public Task<T> JsonAsync<T>()

Returns

Task<T>

A Task which resolves to a T representation of response body.

Type Parameters

T

The type of the response.

See Also

TextAsync()

Returns a Task which resolves to a text representation of response body.

public Task<string> TextAsync()

Returns

Task<string>

A Task which resolves to a text representation of response body.