(init)
| 12861 | // Creates network error Response. |
| 12862 | static error() { |
| 12863 | const responseObject = fromInnerResponse(makeNetworkError(), "immutable"); |
| 12864 | return responseObject; |
| 12865 | } |
| 12866 | // https://fetch.spec.whatwg.org/#dom-response-json |
| 12867 | static json(data, init = {}) { |
| 12868 | webidl.argumentLengthCheck(arguments, 1, "Response.json"); |
| 12869 | if (init !== null) { |
| 12870 | init = webidl.converters.ResponseInit(init); |
| 12871 | } |
| 12872 | const bytes = textEncoder.encode( |
| 12873 | serializeJavascriptValueToJSONString(data) |
| 12874 | ); |
| 12875 | const body = extractBody(bytes); |
| 12876 | const responseObject = fromInnerResponse(makeResponse({}), "response"); |
| 12877 | initializeResponse(responseObject, init, { body: body[0], type: "application/json" }); |
| 12878 | return responseObject; |
| 12879 | } |
| 12880 | // Creates a redirect Response that redirects to url with status status. |
| 12881 | static redirect(url, status = 302) { |
no test coverage detected