Interface IResponse
- Namespace
- Microsoft.Playwright
- Assembly
- Microsoft.Playwright.dll
IResponse class represents responses which are received by page.
public interface IResponse
Properties
Frame
Returns the IFrame that initiated this response.
IFrame Frame { get; }
Property Value
FromServiceWorker
Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via FetchEvent.respondWith).
bool FromServiceWorker { get; }
Property Value
Headers
An object with the response HTTP headers. The header names are lower-cased. Note
that this method does not return security-related headers, including cookie-related
ones. You can use AllHeadersAsync() for complete list of headers
that include cookie
information.
Dictionary<string, string> Headers { get; }
Property Value
Ok
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
bool Ok { get; }
Property Value
Request
Returns the matching IRequest object.
IRequest Request { get; }
Property Value
Status
Contains the status code of the response (e.g., 200 for a success).
int Status { get; }
Property Value
StatusText
Contains the status text of the response (e.g. usually an "OK" for a success).
string StatusText { get; }
Property Value
Url
Contains the URL of the response.
string Url { get; }
Property Value
Methods
AllHeadersAsync()
An object with all the response HTTP headers associated with this response.
Task<Dictionary<string, string>> AllHeadersAsync()
Returns
BodyAsync()
Returns the buffer with response body.
Task<byte[]> BodyAsync()
Returns
FinishedAsync()
Waits for this response to finish, returns always null
.
Task<string?> FinishedAsync()
Returns
HeaderValueAsync(string)
Returns the value of the header matching the name. The name is case insensitive.
If multiple headers have the same name (except set-cookie
), they are returned
as a list separated by ,
. For set-cookie
, the \n
separator
is used. If no headers are found, null
is returned.
Task<string?> HeaderValueAsync(string name)
Parameters
name
stringName of the header.
Returns
HeaderValuesAsync(string)
Returns all values of the headers matching the name, for example set-cookie
.
The name is case insensitive.
Task<IReadOnlyList<string>> HeaderValuesAsync(string name)
Parameters
name
stringName of the header.
Returns
HeadersArrayAsync()
An array with all the request HTTP headers associated with this response. Unlike
AllHeadersAsync(), header names are NOT lower-cased. Headers
with multiple entries, such as Set-Cookie
, appear in the array multiple times.
Task<IReadOnlyList<Header>> HeadersArrayAsync()
Returns
JsonAsync()
Returns the JSON representation of response body.
This method will throw if the response body is not parsable via JSON.parse
.
Task<JsonElement?> JsonAsync()
Returns
JsonAsync<T>()
Task<T> JsonAsync<T>()
Returns
- Task<T>
Type Parameters
T
SecurityDetailsAsync()
Returns SSL and other security information.
Task<ResponseSecurityDetailsResult?> SecurityDetailsAsync()
Returns
ServerAddrAsync()
Returns the IP address and port of the server.
Task<ResponseServerAddrResult?> ServerAddrAsync()
Returns
TextAsync()
Returns the text representation of response body.
Task<string> TextAsync()