Skip to content

Instantly share code, notes, and snippets.

@othree
Last active August 29, 2015 14:25
Show Gist options
  • Save othree/1d5f235b7ed0ae89742f to your computer and use it in GitHub Desktop.
Save othree/1d5f235b7ed0ae89742f to your computer and use it in GitHub Desktop.
{
"!name": "fetch",
"Headers": {
"!type": "fn(init?: object)",
"!doc": "Represents response/request headers, allowing you to query them and take different actions depending on the results.",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers",
"prototype": {
"append": {
"!type": "fn(name: string, value: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/append",
"!doc": "Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist."
},
"delete": {
"!type": "fn(name: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/delete",
"!doc": "Deletes a header from a Headers object."
},
"get": {
"!type": "fn(name: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/get",
"!doc": "Returns the first value of a given header from within a Headers object."
},
"getAll": {
"!type": "fn(name: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/getAll",
"!doc": "Returns an array of all the values of a header within a Headers object with a given name."
},
"has": {
"!type": "fn(name: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/has",
"!doc": "Returns a boolean stating whether a Headers object contains a certain header."
},
"set": {
"!type": "fn(name: string, value: string)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Headers/set",
"!doc": "Sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist."
}
}
},
"Response": {
"!type": "fn(body: object, init?: object)",
"!doc": "Represents the response to a request.",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response",
"prototype": {
"type": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/type",
"!doc": "Contains the type of the response (e.g., basic, cors)."
},
"url": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/url",
"!doc": "Contains the URL of the response."
},
"status": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/status",
"!doc": "Contains the status code of the response (e.g., 200 for a success)."
},
"ok": {
"!type": "bool",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/ok",
"!doc": "Contains a boolean stating whether the response was successful (status in the range 200-299) or not."
},
"statusText": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/statusText",
"!doc": "Contains the status message corresponding to the status code (e.g., OK for 200)."
},
"headers": {
"!type": "+Headers",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/headers",
"!doc": "Contains the Headers object associated with the response."
},
"bodyUsed": {
"!type": "bool",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/bodyUsed",
"!doc": "Stores a Boolean that declares whether the body has been used in a response yet."
},
"clone": {
"!type": "fn() -> +Response",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/clone",
"!doc": "Creates a clone of a Response object."
},
"error": {
"!type": "fn() -> +Response",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/error",
"!doc": "Returns a new Response object associated with a network error."
},
"redirect": {
"!type": "fn(url: string, status?: number) -> +Response",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect",
"!doc": "Creates a new response with a different URL."
},
"arrayBuffer": {
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/arrayBuffer",
"!doc": "Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer."
},
"blob": {
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/blob",
"!doc": "Takes a Response stream and reads it to completion. It returns a promise that resolves with a Blob."
},
"formData": {
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/formData",
"!doc": "Takes a Response stream and reads it to completion. It returns a promise that resolves with a FormData object."
},
"json": {
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/json",
"!doc": "Takes a Response stream and reads it to completion. It returns a promise that resolves with a JSON object."
},
"text": {
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/Body/text",
"!doc": "Takes a Response stream and reads it to completion. It returns a promise that resolves with a USVString (text)."
}
}
},
"fetch": {
"!type": "fn(url: string, init?: object) -> +Promise[value=+Response]",
"!url": "https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch",
"!doc": "The fetch() method used to fetch a resource."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment