APIResponse
APIResponse class represents responses returned by ApiRequestContext.GetAsync() and similar methods.
方法 (Methods)
BodyAsync
Added in: v1.16Returns the buffer with response body.
使用方式
await ApiResponse.BodyAsync();
傳回值
DisposeAsync
Added in: v1.16Disposes the body of this response. If not called then the body will stay in memory until the context closes.
使用方式
await ApiResponse.DisposeAsync();
傳回值
Headers
Added in: v1.16An object with all the response HTTP headers associated with this response.
使用方式
ApiResponse.Headers
傳回值
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.
使用方式
ApiResponse.HeadersArray
傳回值
- 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
.
使用方式
await ApiResponse.JsonAsync();
傳回值
Ok
Added in: v1.16Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
使用方式
ApiResponse.Ok
傳回值
Status
Added in: v1.16Contains the status code of the response (e.g., 200 for a success).
使用方式
ApiResponse.Status
傳回值
StatusText
Added in: v1.16Contains the status text of the response (e.g. usually an "OK" for a success).
使用方式
ApiResponse.StatusText
傳回值
TextAsync
Added in: v1.16Returns the text representation of response body.
使用方式
await ApiResponse.TextAsync();
傳回值
Url
Added in: v1.16Contains the URL of the response.
使用方式
ApiResponse.Url
傳回值