Definition
Fetch Standard defines Response
[Exposed=(Window,Worker)]interface Response {
constructor(optional BodyInit? body = null, optional ResponseInit init = {});
[NewObject] static Response error();
[NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
[NewObject] static Response json(any data, optional ResponseInit init = {});
readonly attribute ResponseType type;
readonly attribute USVString url;
readonly attribute boolean redirected;
readonly attribute unsigned short status;
readonly attribute boolean ok;
readonly attribute ByteString statusText;
[SameObject] readonly attribute Headers headers;
[NewObject] Response clone();
};
Response includes Body;
Consolidated IDL (across mixin and partials)
[Exposed=(Window,Worker)]interface Response {
constructor(optional BodyInit? body = null, optional ResponseInit init = {});
[NewObject] static Response error();
[NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
[NewObject] static Response json(any data, optional ResponseInit init = {});
readonly attribute ResponseType type;
readonly attribute USVString url;
readonly attribute boolean redirected;
readonly attribute unsigned short status;
readonly attribute boolean ok;
readonly attribute ByteString statusText;
[SameObject] readonly attribute Headers headers;
[NewObject] Response clone();
readonly attribute ReadableStream? body;
readonly attribute boolean bodyUsed;
[NewObject] Promise<ArrayBuffer> arrayBuffer();
[NewObject] Promise<Blob> blob();
[NewObject] Promise<Uint8Array> bytes();
[NewObject] Promise<FormData> formData();
[NewObject] Promise<any> json();
[NewObject] Promise<USVString> text();
};
Methods and attributes that return objects implementing Response
Referring IDL interfaces/dictionaries
Referring specifications
- Background Fetch refers to
Response
- Service Workers Nightly refers to
Response
- WebAssembly Web API refers to
Response