Skip to main content

APIResponse

APIResponse 类表示由 APIRequestContext.get() 及类似方法返回的响应。


方法

🌐 Methods

body

Added in: v1.16 apiResponse.body

返回带有响应正文的缓冲区。

🌐 Returns the buffer with response body.

用法

APIResponse.body();

返回


dispose

Added in: v1.16 apiResponse.dispose

释放此响应的主体。如果不调用此方法,主体将一直保留在内存中,直到上下文关闭。

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

用法

APIResponse.dispose();

返回


headers

Added in: v1.16 apiResponse.headers

包含与此响应关联的所有响应 HTTP 标头的对象。

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

用法

APIResponse.headers();

返回


headersArray

Added in: v1.16 apiResponse.headersArray

一个包含与此响应相关的所有 HTTP 响应头的数组。头名称不会转换为小写。具有多个条目的头,例如 Set-Cookie,会在数组中出现多次。

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

用法

APIResponse.headersArray();

返回


ok

Added in: v1.16 apiResponse.ok

包含一个布尔值,说明响应是否成功(状态范围为 200-299)。

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

用法

APIResponse.ok();

返回


status

Added in: v1.16 apiResponse.status

包含响应的状态代码(例如,200 表示成功)。

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

用法

APIResponse.status();

返回


statusText

Added in: v1.16 apiResponse.statusText

包含响应的状态文本(例如,通常成功时为“OK”)。

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

用法

APIResponse.statusText();

返回


text

Added in: v1.16 apiResponse.text

返回响应正文的文本表示形式。

🌐 Returns the text representation of response body.

用法

APIResponse.text();

返回


url

Added in: v1.16 apiResponse.url

包含响应的 URL。

🌐 Contains the URL of the response.

用法

APIResponse.url();

返回