Response<TRequest>
Namespace: PuppeteerSharp
public abstract class Response<TRequest> : IResponse where TRequest : IRequestSupports 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.
Type parameters
| Name | Description |
|---|---|
TRequest |
Inheritance: object
Implements: IResponse
Derived: BidiHttpResponse, CdpHttpResponse
Properties
Section titled “Properties”public IFrame Frame { get; }A Frame that initiated this request. Or null if navigating to error pages.
Value: IFrame
FromCache
Section titled “FromCache”public abstract bool FromCache { get; }True if the response was served from either the browser’s disk cache or memory cache.
Value: bool
FromServiceWorker
Section titled “FromServiceWorker”public bool FromServiceWorker { get; protected init; }Gets a value indicating whether the IResponse was served by a service worker.
Value: bool — true if the IResponse was served by a service worker; otherwise, false.
Headers
Section titled “Headers”public Dictionary<string, string> Headers { get; protected init; }An object with HTTP headers associated with the response. All header names are lower-case.
Duplicate header values are combined into a single comma-separated list except for
Set-Cookie that is separated by \n.
Value: Dictionary<string, string> — The headers.
public bool Ok { get; }Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
Value: bool — true if ok; otherwise, false.
RemoteAddress
Section titled “RemoteAddress”public RemoteAddress RemoteAddress { get; protected init; }Remove server address.
Value: RemoteAddress
Request
Section titled “Request”protected TRequest Request { get; init; }Value: TRequest
SecurityDetails
Section titled “SecurityDetails”public SecurityDetails SecurityDetails { get; protected init; }Gets or sets the security details.
Value: SecurityDetails — The security details.
Status
Section titled “Status”public HttpStatusCode Status { get; protected init; }Contains the status code of the response.
Value: HttpStatusCode — The status.
StatusText
Section titled “StatusText”public string StatusText { get; protected init; }Contains the status text of the response (e.g. usually an “OK” for a success).
Value: string — The status text.
Timing
Section titled “Timing”public ResourceTiming Timing { get; protected init; }Resource timing information for this response.
Value: ResourceTiming
public string Url { get; protected init; }Contains the URL of the response.
Value: string
Methods
Section titled “Methods”AsFetchResponseAsync()
Section titled “AsFetchResponseAsync()”public Task<HttpResponseMessage> AsFetchResponseAsync()Converts the response to an HttpResponseMessage instance.
Returns: Task<HttpResponseMessage> — A Task which resolves to an HttpResponseMessage representation of the response.
Headers are copied to the new response, with multi-line set-cookie headers split into
individual header entries. For responses with null body statuses (101, 204, 205, 304), the body is omitted.
BufferAsync()
Section titled “BufferAsync()”public abstract ValueTask<byte[]> BufferAsync()Returns a Task which resolves to a buffer with response body.
Returns: ValueTask<byte[]> — A Task which resolves to a buffer with response body.
JsonAsync(JsonDocumentOptions)
Section titled “JsonAsync(JsonDocumentOptions)”public Task<JsonDocument> JsonAsync(JsonDocumentOptions options = default)Returns a Task which resolves to a JsonDocument representation of response body.
Parameters
| Name | Type | Description |
|---|---|---|
options |
JsonDocumentOptions | Parsing options. |
Returns: Task<JsonDocument> — A Task which resolves to a JsonDocument representation of response body.
JsonAsync<T>(JsonSerializerOptions)
Section titled “JsonAsync<T>(JsonSerializerOptions)”public Task<T> JsonAsync<T>(JsonSerializerOptions options = null)Returns a Task which resolves to a <code class=“typeparamref”>T</code> representation of response body.
Type parameters
| Name | Description |
|---|---|
T |
The type of the response. |
Parameters
| Name | Type | Description |
|---|---|---|
options |
JsonSerializerOptions | Parsing options. |
Returns: Task<T> — A Task which resolves to a <code class=“typeparamref”>T</code> representation of response body.
TextAsync()
Section titled “TextAsync()”public Task<string> TextAsync()Returns a Task which resolves to a text representation of response body.
Returns: Task<string> — A Task which resolves to a text representation of response body.
Made with love by Dario Kondratiuk