APIResponse
APIResponse class represents responses returned by ApiRequestContext.GetAsync() and similar methods.
Methods
BodyAsync
Added in: v1.16Returns the buffer with response body.
Usage
await ApiResponse.BodyAsync();
Returns
DisposeAsync
Added in: v1.16Disposes the body of this response. If not called then the body will stay in memory until the context closes.
Usage
await ApiResponse.DisposeAsync();
Returns
Headers
Added in: v1.16An object with all the response HTTP headers associated with this response.
Usage
ApiResponse.Headers
Returns
HeadersArray
Added in: v1.16An array with all the response 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.
Usage
ApiResponse.HeadersArray
Returns
- IReadOnlyList<
HttpHeader>#
JsonAsync
Added in: v1.16Returns the JSON representation of response body.
This method will throw if the response body is not parsable via JSON.parse.
Usage
await ApiResponse.JsonAsync();
Returns
Ok
Added in: v1.16Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
Usage
ApiResponse.Ok
Returns
SecurityDetailsAsync
Added in: v1.61Returns SSL and other security information. Resolves to null for non-HTTPS responses. For redirected requests, returns the information for the last request in the redirect chain.
Usage
await ApiResponse.SecurityDetailsAsync();
Returns
- SecurityDetails?#
-
issuerstring? (optional)Common Name component of the Issuer field. from the certificate. This should only be used for informational purposes. Optional.
-
protocolstring? (optional)The specific TLS protocol used. (e.g.
TLS 1.3). Optional. -
subjectNamestring? (optional)Common Name component of the Subject field from the certificate. This should only be used for informational purposes. Optional.
-
validFrom[float]? (optional)Unix timestamp (in seconds) specifying when this cert becomes valid. Optional.
-
validTo[float]? (optional)Unix timestamp (in seconds) specifying when this cert becomes invalid. Optional.
-
ServerAddrAsync
Added in: v1.61Returns the IP address and port of the server. Resolves to null if the server address is not available. For redirected requests, returns the information for the last request in the redirect chain.
Usage
await ApiResponse.ServerAddrAsync();
Returns
Status
Added in: v1.16Contains the status code of the response (e.g., 200 for a success).
Usage
ApiResponse.Status
Returns
StatusText
Added in: v1.16Contains the status text of the response (e.g. usually an "OK" for a success).
Usage
ApiResponse.StatusText
Returns
TextAsync
Added in: v1.16Returns the text representation of response body.
Usage
await ApiResponse.TextAsync();
Returns
Url
Added in: v1.16Contains the URL of the response.
Usage
ApiResponse.Url
Returns