Interface IAPIResponse
- Namespace
- Microsoft.Playwright
- Assembly
- Microsoft.Playwright.dll
IAPIResponse class represents responses returned by GetAsync(string, APIRequestContextOptions?) and similar methods.
public interface IAPIResponse : IAsyncDisposable
Properties
Headers
An object with all the response HTTP headers associated with this response.
Dictionary<string, string> Headers { get; }
Property Value
HeadersArray
An array with all the request HTTP headers associated with this response. Header
names are not lower-cased. Headers with multiple entries, such as Set-Cookie
,
appear in the array multiple times.
IReadOnlyList<Header> HeadersArray { 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
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
BodyAsync()
Returns the buffer with response body.
Task<byte[]> BodyAsync()
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>(JsonSerializerOptions?)
Task<T?> JsonAsync<T>(JsonSerializerOptions? options = null)
Parameters
options
JsonSerializerOptions
Returns
- Task<T>
Type Parameters
T
TextAsync()
Returns the text representation of response body.
Task<string> TextAsync()