Victor Porof | 6e09692 | 2022-06-10 13:01:05 +0000 | [diff] [blame] | 1 | // GENERATED CONTENT - DO NOT EDIT |
| 2 | // Content was automatically extracted by Reffy into webref |
| 3 | // (https://github.com/w3c/webref) |
| 4 | // Source: Fetch Standard (https://fetch.spec.whatwg.org/) |
| 5 | |
| 6 | typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit; |
| 7 | |
| 8 | [Exposed=(Window,Worker)] |
| 9 | interface Headers { |
| 10 | constructor(optional HeadersInit init); |
| 11 | |
| 12 | undefined append(ByteString name, ByteString value); |
| 13 | undefined delete(ByteString name); |
| 14 | ByteString? get(ByteString name); |
| 15 | boolean has(ByteString name); |
| 16 | undefined set(ByteString name, ByteString value); |
| 17 | iterable<ByteString, ByteString>; |
| 18 | }; |
| 19 | |
| 20 | typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) XMLHttpRequestBodyInit; |
| 21 | |
| 22 | typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit; |
| 23 | interface mixin Body { |
| 24 | readonly attribute ReadableStream? body; |
| 25 | readonly attribute boolean bodyUsed; |
| 26 | [NewObject] Promise<ArrayBuffer> arrayBuffer(); |
| 27 | [NewObject] Promise<Blob> blob(); |
| 28 | [NewObject] Promise<FormData> formData(); |
| 29 | [NewObject] Promise<any> json(); |
| 30 | [NewObject] Promise<USVString> text(); |
| 31 | }; |
| 32 | typedef (Request or USVString) RequestInfo; |
| 33 | |
| 34 | [Exposed=(Window,Worker)] |
| 35 | interface Request { |
| 36 | constructor(RequestInfo input, optional RequestInit init = {}); |
| 37 | |
| 38 | readonly attribute ByteString method; |
| 39 | readonly attribute USVString url; |
| 40 | [SameObject] readonly attribute Headers headers; |
| 41 | |
| 42 | readonly attribute RequestDestination destination; |
| 43 | readonly attribute USVString referrer; |
| 44 | readonly attribute ReferrerPolicy referrerPolicy; |
| 45 | readonly attribute RequestMode mode; |
| 46 | readonly attribute RequestCredentials credentials; |
| 47 | readonly attribute RequestCache cache; |
| 48 | readonly attribute RequestRedirect redirect; |
| 49 | readonly attribute DOMString integrity; |
| 50 | readonly attribute boolean keepalive; |
| 51 | readonly attribute boolean isReloadNavigation; |
| 52 | readonly attribute boolean isHistoryNavigation; |
| 53 | readonly attribute AbortSignal signal; |
| 54 | |
| 55 | [NewObject] Request clone(); |
| 56 | }; |
| 57 | Request includes Body; |
| 58 | |
| 59 | dictionary RequestInit { |
| 60 | ByteString method; |
| 61 | HeadersInit headers; |
| 62 | BodyInit? body; |
| 63 | USVString referrer; |
| 64 | ReferrerPolicy referrerPolicy; |
| 65 | RequestMode mode; |
| 66 | RequestCredentials credentials; |
| 67 | RequestCache cache; |
| 68 | RequestRedirect redirect; |
| 69 | DOMString integrity; |
| 70 | boolean keepalive; |
| 71 | AbortSignal? signal; |
| 72 | any window; // can only be set to null |
| 73 | }; |
| 74 | |
| 75 | enum RequestDestination { "", "audio", "audioworklet", "document", "embed", "font", "frame", "iframe", "image", "manifest", "object", "paintworklet", "report", "script", "sharedworker", "style", "track", "video", "worker", "xslt" }; |
| 76 | enum RequestMode { "navigate", "same-origin", "no-cors", "cors" }; |
| 77 | enum RequestCredentials { "omit", "same-origin", "include" }; |
| 78 | enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }; |
| 79 | enum RequestRedirect { "follow", "error", "manual" }; |
| 80 | |
| 81 | [Exposed=(Window,Worker)]interface Response { |
| 82 | constructor(optional BodyInit? body = null, optional ResponseInit init = {}); |
| 83 | |
| 84 | [NewObject] static Response error(); |
| 85 | [NewObject] static Response redirect(USVString url, optional unsigned short status = 302); |
| 86 | [NewObject] static Response json(any data, optional ResponseInit init = {}); |
| 87 | |
| 88 | readonly attribute ResponseType type; |
| 89 | |
| 90 | readonly attribute USVString url; |
| 91 | readonly attribute boolean redirected; |
| 92 | readonly attribute unsigned short status; |
| 93 | readonly attribute boolean ok; |
| 94 | readonly attribute ByteString statusText; |
| 95 | [SameObject] readonly attribute Headers headers; |
| 96 | |
| 97 | [NewObject] Response clone(); |
| 98 | }; |
| 99 | Response includes Body; |
| 100 | |
| 101 | dictionary ResponseInit { |
| 102 | unsigned short status = 200; |
| 103 | ByteString statusText = ""; |
| 104 | HeadersInit headers; |
| 105 | }; |
| 106 | |
| 107 | enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" }; |
| 108 | |
| 109 | partial interface mixin WindowOrWorkerGlobalScope { |
| 110 | [NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {}); |
| 111 | }; |