Skip to content

Instantly share code, notes, and snippets.

@jkantr

jkantr/0.md Secret

Last active August 17, 2018 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkantr/a8036d22b6aaec0626ae2340a1aaf1e2 to your computer and use it in GitHub Desktop.
Save jkantr/a8036d22b6aaec0626ae2340a1aaf1e2 to your computer and use it in GitHub Desktop.
{
	// These properties are part of the Fetch Standard
	method: 'GET',
	headers: {},        // request headers. format is the identical to that accepted by the Headers constructor (see below)
	body: null,         // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream
	redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect
 	// The following properties are node-fetch extensions
	follow: 20,         // maximum redirect count. 0 to not follow redirect
	timeout: 0,         // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
	compress: true,     // support gzip/deflate content encoding. false to disable
	size: 0,            // maximum response body size in bytes. 0 to disable
	agent: null         // http(s).Agent instance, allows custom proxy, certificate, lookup, family etc.
}
Property Default Description
Standard
method 'GET'
headers {} request headers. format is the same as accepted by the Headers constructor (see below)
body null request body. can be null, a string, a Buffer, a Blob, a URLSearchParams, or a Node.js Readable stream
redirect 'follow' set to manual to extract redirect headers, error to reject redirect
Extensions
follow 20 maximum redirect count. 0 to not follow redirect
timeout 0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
compress true support gzip/deflate content encoding. false to disable
size 0 maximum response body size in bytes. 0 to disable
agent null http(s).Agent instance, allows custom proxy, certificate, dns lookup, ip family, etc.
Property Default Fetch Standard Description
method 'GET' Yes
headers {} Yes request headers. format is the same as accepted by the Headers constructor (see below)
body null Yes request body. can be null, a string, a Buffer, a Blob, a URLSearchParams, or a Node.js Readable stream
redirect 'follow' Yes set to manual to extract redirect headers, error to reject redirect
follow 20 No maximum redirect count. 0 to not follow redirect
timeout 0 No req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
compress true No support gzip/deflate content encoding. false to disable
size 0 No maximum response body size in bytes. 0 to disable
agent null No http(s).Agent instance, allows custom proxy, certificate, dns lookup, ip family, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment