Skip to main content

HTTPResponse.asFetchResponse() 方法

🌐 HTTPResponse.asFetchResponse() method

将响应转换为 Fetch API 的 Response 实例。

🌐 Converts the response to a Fetch API Response instance.

语法​

🌐 Signature

class HTTPResponse {
asFetchResponse(): Promise<Response>;
}

返回:

Promise<Response>

一个返回 Fetch API Response 对象的 Promise。

🌐 A promise which resolves to a Fetch API Response object.

附注​

🌐 Remarks

头信息会被复制到新的 Response 实例中,多行的 set-cookie 头信息会被解析成单独的头信息条目。对于空体状态(101、204、205、304)的响应,主体会被省略。

🌐 Headers are copied to the new Response instance, with multi-line set-cookie headers parsed into individual header entries. For responses with null body statuses (101, 204, 205, 304), the body is omitted.