跳到正文
本页尚未翻译成中文,以下为英文原文。 查看英文版

APIResponse ​

Added in: v1.16

APIResponse class represents responses returned by ApiRequestContext.GetAsync() and similar methods.

Methods ​

ApiResponse.BodyAsync() ​

Added in: v1.16

Returns the buffer with response body.

Returns

  • Buffer

ApiResponse.DisposeAsync() ​

Added in: v1.16

Disposes the body of this response. If not called then the body will stay in memory until the context closes.

ApiResponse.Headers() ​

Added in: v1.16

An object with all the response HTTP headers associated with this response.

Returns

  • Object<string, string>

ApiResponse.HeadersArray() ​

Added in: v1.16

An 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.

Returns

  • Array<Object>

ApiResponse.JsonAsync() ​

Added in: v1.16

Returns the JSON representation of response body.

This method will throw if the response body is not parsable via JSON.parse.

Returns

  • null | JsonElement

ApiResponse.Ok() ​

Added in: v1.16

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

Returns

  • boolean

ApiResponse.SecurityDetailsAsync() ​

Added in: v1.61

Returns 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.

Returns

  • null | Object

ApiResponse.ServerAddrAsync() ​

Added in: v1.61

Returns 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.

Returns

  • null | Object

ApiResponse.Status() ​

Added in: v1.16

Contains the status code of the response (e.g., 200 for a success).

Returns

  • int

ApiResponse.StatusText() ​

Added in: v1.16

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

Returns

  • string

ApiResponse.TextAsync() ​

Added in: v1.16

Returns the text representation of response body.

Returns

  • string

ApiResponse.Timing() ​

Added in: v1.62

Returns resource timing information for given response. For redirected requests, returns the information for the last request in the redirect chain. When the response is served from the HAR file, timing information is not available and all the values are -1. Find more information at Resource Timing API.

Returns

  • Object

ApiResponse.Url() ​

Added in: v1.16

Contains the URL of the response.

Returns

  • string

基于 Apache 2.0 许可证发布。