Comparing version 10.1.0 to 10.2.0
@@ -1,2 +0,2 @@ | ||
import { CancelableRequest, NormalizedOptions } from './utils/types'; | ||
import { CancelableRequest, NormalizedOptions } from './types'; | ||
export default function asPromise<T>(options: NormalizedOptions): CancelableRequest<T>; |
@@ -25,3 +25,2 @@ "use strict"; | ||
let body; | ||
// @ts-ignore `.json()`, `.buffer()` and `.text()` are added later | ||
const promise = new PCancelable((resolve, reject, onCancel) => { | ||
@@ -77,6 +76,6 @@ const emitter = request_as_event_emitter_1.default(options); | ||
for (const [index, hook] of options.hooks.afterResponse.entries()) { | ||
// @ts-ignore Promise is not assignable to CancelableRequest | ||
// @ts-ignore TS doesn't notice that CancelableRequest is a Promise | ||
// eslint-disable-next-line no-await-in-loop | ||
response = await hook(response, async (updatedOptions) => { | ||
updatedOptions = normalize_arguments_1.normalizeArguments(normalize_arguments_1.mergeOptions(options, { | ||
const typedOptions = normalize_arguments_1.normalizeArguments(normalize_arguments_1.mergeOptions(options, { | ||
...updatedOptions, | ||
@@ -91,8 +90,8 @@ retry: { | ||
// The loop continues. We don't want duplicates (asPromise recursion). | ||
updatedOptions.hooks.afterResponse = options.hooks.afterResponse.slice(0, index); | ||
typedOptions.hooks.afterResponse = options.hooks.afterResponse.slice(0, index); | ||
for (const hook of options.hooks.beforeRetry) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await hook(updatedOptions); | ||
await hook(typedOptions); | ||
} | ||
const promise = asPromise(updatedOptions); | ||
const promise = asPromise(typedOptions); | ||
onCancel(() => { | ||
@@ -99,0 +98,0 @@ promise.catch(() => { }); |
/// <reference types="node" /> | ||
import { Duplex as DuplexStream } from 'stream'; | ||
import { GotEvents, NormalizedOptions } from './utils/types'; | ||
import { GotEvents, NormalizedOptions } from './types'; | ||
export declare class ProxyStream<T = unknown> extends DuplexStream implements GotEvents<ProxyStream<T>> { | ||
@@ -5,0 +5,0 @@ isFromCache?: boolean; |
@@ -10,11 +10,2 @@ "use strict"; | ||
class ProxyStream extends stream_1.Duplex { | ||
constructor() { | ||
super(...arguments); | ||
Object.defineProperty(this, "isFromCache", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
} | ||
@@ -21,0 +12,0 @@ exports.ProxyStream = ProxyStream; |
@@ -1,3 +0,3 @@ | ||
import { RetryFunction } from './utils/types'; | ||
import { RetryFunction } from './types'; | ||
declare const calculateRetryDelay: RetryFunction; | ||
export default calculateRetryDelay; |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import * as errors from './errors'; | ||
import { CancelableRequest, Defaults, ExtendOptions, HandlerFunction, NormalizedOptions, Options, Response, URLOrOptions } from './utils/types'; | ||
import { CancelableRequest, Defaults, ExtendOptions, HandlerFunction, NormalizedOptions, Options, Response, URLOrOptions } from './types'; | ||
export declare type HTTPAlias = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete'; | ||
@@ -8,0 +8,0 @@ export declare type ReturnStream = <T>(url: string | Merge<Options, { |
@@ -21,3 +21,2 @@ "use strict"; | ||
// Proxy properties from next handlers | ||
// @ts-ignore Internal use only. | ||
defaults._rawHandlers = defaults.handlers; | ||
@@ -42,5 +41,3 @@ defaults.handlers = defaults.handlers.map(fn => ((options, next) => { | ||
const iterateHandlers = (newOptions) => { | ||
return defaults.handlers[iteration++](newOptions, | ||
// @ts-ignore TS doesn't know that it calls `getPromiseOrStream` at the end | ||
iteration === defaults.handlers.length ? getPromiseOrStream : iterateHandlers); | ||
return defaults.handlers[iteration++](newOptions, iteration === defaults.handlers.length ? getPromiseOrStream : iterateHandlers); | ||
}; | ||
@@ -64,3 +61,2 @@ /* eslint-disable @typescript-eslint/return-await */ | ||
const optionsArray = [defaults.options]; | ||
// @ts-ignore Internal use only. | ||
let handlers = [...defaults._rawHandlers]; | ||
@@ -71,3 +67,2 @@ let mutableDefaults; | ||
optionsArray.push(value.defaults.options); | ||
// @ts-ignore Internal use only. | ||
handlers.push(...value.defaults._rawHandlers); | ||
@@ -97,3 +92,3 @@ mutableDefaults = value.defaults.mutableDefaults; | ||
for (const method of aliases) { | ||
// @ts-ignore GotReturn<Response> does not equal GotReturn<T> | ||
// @ts-ignore Cannot properly type a function with multiple definitions yet | ||
got[method] = (url, options) => got(url, { ...options, method }); | ||
@@ -100,0 +95,0 @@ got.stream[method] = (url, options) => got.stream(url, { ...options, method }); |
import { Timings } from '@szmarczak/http-timer'; | ||
import { TimeoutError as TimedOutError } from './utils/timed-out'; | ||
import { ErrorCode, Response, NormalizedOptions } from './utils/types'; | ||
import { Response, NormalizedOptions } from './types'; | ||
export declare class GotError extends Error { | ||
code?: ErrorCode; | ||
code?: string; | ||
stack: string; | ||
readonly options: NormalizedOptions; | ||
constructor(message: string, error: Partial<Error & { | ||
code?: ErrorCode; | ||
code?: string; | ||
}>, options: NormalizedOptions); | ||
@@ -11,0 +11,0 @@ } |
@@ -7,14 +7,2 @@ "use strict"; | ||
super(message); | ||
Object.defineProperty(this, "code", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "stack", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Error.captureStackTrace(this, this.constructor); | ||
@@ -109,14 +97,2 @@ this.name = 'GotError'; | ||
super(error.message, error, options); | ||
Object.defineProperty(this, "timings", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "event", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
this.name = 'TimeoutError'; | ||
@@ -123,0 +99,0 @@ this.event = error.event; |
/// <reference types="node" /> | ||
import EventEmitter = require('events'); | ||
import { IncomingMessage } from 'http'; | ||
import { NormalizedOptions } from './utils/types'; | ||
import { NormalizedOptions } from './types'; | ||
declare const _default: (response: IncomingMessage, options: NormalizedOptions, emitter: EventEmitter) => Promise<void>; | ||
export default _default; |
@@ -16,7 +16,11 @@ "use strict"; | ||
options.method !== 'HEAD' ? decompressResponse(progressStream) : progressStream); | ||
if (!options.decompress && ['gzip', 'deflate', 'br'].includes((_a = response.headers['content-encoding'], (_a !== null && _a !== void 0 ? _a : '')))) { | ||
if (!options.decompress && ['gzip', 'deflate', 'br'].includes((_a = newResponse.headers['content-encoding'], (_a !== null && _a !== void 0 ? _a : '')))) { | ||
options.responseType = 'buffer'; | ||
} | ||
emitter.emit('response', newResponse); | ||
return pipeline(response, progressStream); | ||
return pipeline(response, progressStream).catch(error => { | ||
if (error.code !== 'ERR_STREAM_PREMATURE_CLOSE') { | ||
throw error; | ||
} | ||
}); | ||
}; |
declare const got: import("./create").Got; | ||
export default got; | ||
export * from './utils/types'; | ||
export * from './types'; | ||
export { Got, GotStream, ReturnStream, GotReturn } from './create'; | ||
@@ -5,0 +5,0 @@ export { ProxyStream as ResponseStream } from './as-stream'; |
@@ -1,2 +0,2 @@ | ||
import { CancelableRequest, GeneralError, NormalizedOptions, Options, Response } from './utils/types'; | ||
import { CancelableRequest, GeneralError, NormalizedOptions, Options, Response } from './types'; | ||
/** | ||
@@ -3,0 +3,0 @@ Called with plain request options, right before their normalization. This is especially useful in conjunction with `got.extend()` when the input needs custom handling. |
@@ -6,6 +6,6 @@ /// <reference types="node" /> | ||
import { Merge } from 'type-fest'; | ||
import { Defaults, NormalizedOptions, RequestFunction, URLOrOptions } from './utils/types'; | ||
export declare const preNormalizeArguments: (options: Merge<https.RequestOptions, Merge<import("./utils/types").GotOptions, import("./utils/options-to-url").URLOptions>>, defaults?: NormalizedOptions | undefined) => NormalizedOptions; | ||
export declare const mergeOptions: (...sources: Merge<https.RequestOptions, Merge<import("./utils/types").GotOptions, import("./utils/options-to-url").URLOptions>>[]) => NormalizedOptions; | ||
export declare const normalizeArguments: (url: URLOrOptions, options?: Merge<https.RequestOptions, Merge<import("./utils/types").GotOptions, import("./utils/options-to-url").URLOptions>> | undefined, defaults?: Defaults | undefined) => NormalizedOptions; | ||
import { Defaults, NormalizedOptions, RequestFunction, URLOrOptions } from './types'; | ||
export declare const preNormalizeArguments: (options: Merge<https.RequestOptions, Merge<import("./types").GotOptions, import("./utils/options-to-url").URLOptions>>, defaults?: NormalizedOptions | undefined) => NormalizedOptions; | ||
export declare const mergeOptions: (...sources: Merge<https.RequestOptions, Merge<import("./types").GotOptions, import("./utils/options-to-url").URLOptions>>[]) => NormalizedOptions; | ||
export declare const normalizeArguments: (url: URLOrOptions, options?: Merge<https.RequestOptions, Merge<import("./types").GotOptions, import("./utils/options-to-url").URLOptions>> | undefined, defaults?: Defaults | undefined) => NormalizedOptions; | ||
export declare type NormalizedRequestArguments = Merge<https.RequestOptions, { | ||
@@ -12,0 +12,0 @@ body?: stream.Readable; |
@@ -114,3 +114,2 @@ "use strict"; | ||
if (options.retry.maxRetryAfter === undefined) { | ||
// @ts-ignore We assign if it is undefined, so this IS correct | ||
options.retry.maxRetryAfter = Math.min(...[options.timeout.request, options.timeout.connect].filter((n) => !is_1.default.nullOrUndefined(n))); | ||
@@ -135,3 +134,3 @@ } | ||
options.cacheableRequest = new CacheableRequest( | ||
// @ts-ignore Types broke on infer | ||
// @ts-ignore Cannot properly type a function with multiple definitions yet | ||
(requestOptions, handler) => requestOptions.request(requestOptions, handler), options.cache); | ||
@@ -145,3 +144,3 @@ } | ||
if (!Reflect.has(setCookie, util_1.promisify.custom)) { | ||
// @ts-ignore We check for non-promisified setCookie, so this IS correct | ||
// @ts-ignore TS is dumb. | ||
setCookie = util_1.promisify(setCookie.bind(options.cookieJar)); | ||
@@ -360,3 +359,4 @@ getCookieString = util_1.promisify(getCookieString.bind(options.cookieJar)); | ||
const electron = dynamic_require_1.default(module, 'electron'); // Trick webpack | ||
options.request = (_c = electron.net.request, (_c !== null && _c !== void 0 ? _c : electron.remote.net.request)); | ||
options.request = util_1.deprecate((_c = electron.net.request, (_c !== null && _c !== void 0 ? _c : electron.remote.net.request)), 'Electron support has been deprecated and will be removed in Got 11.\n' + | ||
'See https://github.com/sindresorhus/got/issues/899 for further information.', 'GOT_ELECTRON'); | ||
} | ||
@@ -363,0 +363,0 @@ // Got's `timeout` is an object, http's `timeout` is a number, so they're not compatible. |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { GotError } from './errors'; | ||
import { NormalizedOptions } from './utils/types'; | ||
import { NormalizedOptions } from './types'; | ||
export interface RequestAsEventEmitter extends EventEmitter { | ||
@@ -8,0 +8,0 @@ retry: <T extends GotError>(error: T) => boolean; |
@@ -69,3 +69,2 @@ "use strict"; | ||
if (!typedResponse.isFromCache) { | ||
// @ts-ignore Node.js typings haven't been updated yet | ||
typedResponse.ip = response.socket.remoteAddress; | ||
@@ -89,5 +88,11 @@ } | ||
} | ||
delete options.body; | ||
delete options.json; | ||
delete options.form; | ||
if (Reflect.has(options, 'body')) { | ||
delete options.body; | ||
} | ||
if (Reflect.has(options, 'json')) { | ||
delete options.json; | ||
} | ||
if (Reflect.has(options, 'form')) { | ||
delete options.form; | ||
} | ||
} | ||
@@ -101,3 +106,3 @@ if (redirects.length >= options.maxRedirects) { | ||
// Redirecting to a different site, clear cookies. | ||
if (redirectURL.hostname !== options.url.hostname) { | ||
if (redirectURL.hostname !== options.url.hostname && Reflect.has(options.headers, 'cookie')) { | ||
delete options.headers.cookie; | ||
@@ -115,11 +120,3 @@ } | ||
} | ||
try { | ||
await get_response_1.default(typedResponse, options, emitter); | ||
} | ||
catch (error) { | ||
// Don't throw `Premature close` if the request has been aborted | ||
if (!(isAborted() && error.message === 'Premature close')) { | ||
throw error; | ||
} | ||
} | ||
await get_response_1.default(typedResponse, options, emitter); | ||
} | ||
@@ -185,3 +182,3 @@ catch (error) { | ||
}; | ||
// @ts-ignore ResponseLike missing socket field, should be fixed upstream | ||
// @ts-ignore `cacheable-request` has got invalid types | ||
const cacheRequest = options.cacheableRequest(httpOptions, handleResponse); | ||
@@ -201,3 +198,2 @@ cacheRequest.once('error', (error) => { | ||
try { | ||
// @ts-ignore ResponseObject does not equal IncomingMessage | ||
handleRequest(httpOptions.request(options.url, httpOptions, handleResponse)); | ||
@@ -204,0 +200,0 @@ } |
/// <reference types="node" /> | ||
declare const _default: (options: import("type-fest").Merge<import("https").RequestOptions, import("type-fest").Merge<import("./types").GotOptions, import("./options-to-url").URLOptions>>) => Promise<number | undefined>; | ||
import { ClientRequestArgs } from 'http'; | ||
interface Options { | ||
body?: unknown; | ||
headers: ClientRequestArgs['headers']; | ||
} | ||
declare const _default: (options: Options) => Promise<number | undefined>; | ||
export default _default; |
@@ -9,7 +9,7 @@ "use strict"; | ||
exports.default = async (options) => { | ||
const { body, headers, isStream } = options; | ||
const { body, headers } = options; | ||
if (headers && 'content-length' in headers) { | ||
return Number(headers['content-length']); | ||
} | ||
if (!body && !isStream) { | ||
if (!body) { | ||
return 0; | ||
@@ -16,0 +16,0 @@ } |
import { ClientRequest } from 'http'; | ||
import { Delays, ErrorCode } from './types'; | ||
declare const reentry: unique symbol; | ||
@@ -9,2 +8,12 @@ interface TimedOutOptions { | ||
} | ||
export interface Delays { | ||
lookup?: number; | ||
connect?: number; | ||
secureConnect?: number; | ||
socket?: number; | ||
response?: number; | ||
send?: number; | ||
request?: number; | ||
} | ||
export declare type ErrorCode = 'ETIMEDOUT' | 'ECONNRESET' | 'EADDRINUSE' | 'ECONNREFUSED' | 'EPIPE' | 'ENOTFOUND' | 'ENETUNREACH' | 'EAI_AGAIN'; | ||
export declare class TimeoutError extends Error { | ||
@@ -11,0 +20,0 @@ event: string; |
@@ -10,14 +10,3 @@ "use strict"; | ||
super(`Timeout awaiting '${event}' for ${threshold}ms`); | ||
Object.defineProperty(this, "event", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: event | ||
}); | ||
Object.defineProperty(this, "code", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
this.event = event; | ||
this.name = 'TimeoutError'; | ||
@@ -24,0 +13,0 @@ this.code = 'ETIMEDOUT'; |
@@ -9,3 +9,3 @@ "use strict"; | ||
protocol: url.protocol, | ||
hostname: url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, | ||
hostname: is_1.default.string(url.hostname) && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, | ||
host: url.host, | ||
@@ -16,3 +16,3 @@ hash: url.hash, | ||
href: url.href, | ||
path: is_1.default.null_(url.search) ? url.pathname : `${url.pathname}${url.search}` | ||
path: `${url.pathname || ''}${url.search || ''}` | ||
}; | ||
@@ -23,5 +23,5 @@ if (is_1.default.string(url.port) && url.port.length !== 0) { | ||
if (url.username || url.password) { | ||
options.auth = `${url.username}:${url.password}`; | ||
options.auth = `${url.username || ''}:${url.password || ''}`; | ||
} | ||
return options; | ||
}; |
{ | ||
"name": "got", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "Human-friendly and powerful HTTP request library for Node.js", | ||
@@ -60,12 +60,12 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^0.6.0", | ||
"@sindresorhus/tsconfig": "^0.7.0", | ||
"@types/duplexer3": "^0.1.0", | ||
"@types/express": "^4.17.2", | ||
"@types/lolex": "^5.1.0", | ||
"@types/node": "^12.12.14", | ||
"@types/node": "^13.1.0", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^7.0.13", | ||
"@types/tough-cookie": "^2.3.5", | ||
"@typescript-eslint/eslint-plugin": "2.10.0", | ||
"@typescript-eslint/parser": "2.10.0", | ||
"@typescript-eslint/eslint-plugin": "^2.13.0", | ||
"@typescript-eslint/parser": "^2.13.0", | ||
"ava": "^2.4.0", | ||
@@ -76,3 +76,3 @@ "coveralls": "^3.0.4", | ||
"delay": "^4.3.0", | ||
"eslint-config-xo-typescript": "^0.23.0", | ||
"eslint-config-xo-typescript": "^0.24.1", | ||
"express": "^4.17.1", | ||
@@ -85,6 +85,6 @@ "form-data": "^3.0.0", | ||
"np": "^5.1.3", | ||
"nyc": "^14.0.0", | ||
"nyc": "^15.0.0", | ||
"p-event": "^4.0.0", | ||
"proxyquire": "^2.0.1", | ||
"sinon": "^7.5.0", | ||
"sinon": "^8.0.1", | ||
"slow-stream": "0.0.4", | ||
@@ -91,0 +91,0 @@ "tempy": "^0.3.0", |
@@ -44,3 +44,2 @@ <div align="center"> | ||
- [Plugins](documentation/lets-make-a-plugin.md) | ||
- [Electron support](#useelectronnet) | ||
- [Used by 3000+ packages and 1.6M+ repos](https://github.com/sindresorhus/got/network/dependents) | ||
@@ -456,2 +455,4 @@ - Actively maintained | ||
[**Deprecated**](https://github.com/sindresorhus/got#electron-support-has-been-deprecated) | ||
When used in Electron, Got will use [`electron.net`](https://electronjs.org/docs/api/net/) instead of the Node.js `http` module. According to the Electron docs, it should be fully compatible, but it's not entirely. See [#443](https://github.com/sindresorhus/got/issues/443) and [#461](https://github.com/sindresorhus/got/issues/461). | ||
@@ -1415,42 +1416,46 @@ | ||
### Why was Got created? | ||
### Why yet another HTTP client? | ||
Got was created because the popular [`request`](https://github.com/request/request) package is bloated: [![Install size](https://packagephobia.now.sh/badge?p=request)](https://packagephobia.now.sh/result?p=request) | ||
Got was created because the popular [`request`](https://github.com/request/request) package is bloated: [![Install size](https://packagephobia.now.sh/badge?p=request)](https://packagephobia.now.sh/result?p=request)\ | ||
Furthermore, Got is fully written in TypeScript. | ||
### Electron support has been deprecated | ||
Some of the Got features may not work properly. See [#899](https://github.com/sindresorhus/got/issues/899) for more info. | ||
## Comparison | ||
| | `got` | [`request`][r0] | [`node-fetch`][n0] | [`ky`][k0] | [`axios`][a0] | [`superagent`][s0] | | ||
|-----------------------|:----------------:|:---------------:|:--------------------:|:-----------------:|:----------------:|:--------------------:| | ||
| HTTP/2 support | ❔ | ❌ | ❌ | ❌ | ❌ | ✔️\*\* | | ||
| Browser support | ❌ | ❌ | ✔️\* | ✔️ | ✔️ | ✔️ | | ||
| Electron support | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | | ||
| Promise API | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ||
| Stream API | ✔️ | ✔️ | Node.js only | ❌ | ❌ | ✔️ | | ||
| Request cancelation | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | | ||
| RFC compliant caching | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | | ||
| Cookies (out-of-box) | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | | ||
| Follows redirects | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ||
| Retries on failure | ✔️ | ❌ | ❌ | ✔️ | ❌ | ✔️ | | ||
| Progress events | ✔️ | ❌ | ❌ | ✔️\*\*\* | Browser only | ✔️ | | ||
| Handles gzip/deflate | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ||
| Advanced timeouts | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | | ||
| Timings | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | | ||
| Errors with metadata | ✔️ | ❌ | ❌ | ✔️ | ✔️ | ❌ | | ||
| JSON mode | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ||
| Custom defaults | ✔️ | ✔️ | ❌ | ✔️ | ✔️ | ❌ | | ||
| Composable | ✔️ | ❌ | ❌ | ❌ | ❌ | ✔️ | | ||
| Hooks | ✔️ | ❌ | ❌ | ✔️ | ✔️ | ❌ | | ||
| Issues open | [![][gio]][g1] | [![][rio]][r1] | [![][nio]][n1] | [![][kio]][k1] | [![][aio]][a1] | [![][sio]][s1] | | ||
| Issues closed | [![][gic]][g2] | [![][ric]][r2] | [![][nic]][n2] | [![][kic]][k2] | [![][aic]][a2] | [![][sic]][s2] | | ||
| Downloads | [![][gd]][g3] | [![][rd]][r3] | [![][nd]][n3] | [![][kd]][k3] | [![][ad]][a3] | [![][sd]][s3] | | ||
| Coverage | [![][gc]][g4] | [![][rc]][r4] | [![][nc]][n4] | [![][kc]][k4] | [![][ac]][a4] | [![][sc]][s4] | | ||
| Build | [![][gb]][g5] | [![][rb]][r5] | [![][nb]][n5] | [![][kb]][k5] | [![][ab]][a5] | [![][sb]][s5] | | ||
| Bugs | [![][gbg]][g6] | [![][rbg]][r6] | [![][nbg]][n6] | [![][kbg]][k6] | [![][abg]][a6] | [![][sbg]][s6] | | ||
| Dependents | [![][gdp]][g7] | [![][rdp]][r7] | [![][ndp]][n7] | [![][kdp]][k7] | [![][adp]][a7] | [![][sdp]][s7] | | ||
| Install size | [![][gis]][g8] | [![][ris]][r8] | [![][nis]][n8] | [![][kis]][k8] | [![][ais]][a8] | [![][sis]][s8] | | ||
| | `got` | [`request`][r0] | [`node-fetch`][n0] | [`ky`][k0] | [`axios`][a0] | [`superagent`][s0] | | ||
|-----------------------|:------------------:|:------------------:|:--------------------:|:------------------------:|:------------------:|:----------------------:| | ||
| HTTP/2 support | :grey_question: | :x: | :x: | :x: | :x: | :heavy_check_mark:\*\* | | ||
| Browser support | :x: | :x: | :heavy_check_mark:\* | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Promise API | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Stream API | :heavy_check_mark: | :heavy_check_mark: | Node.js only | :x: | :x: | :heavy_check_mark: | | ||
| Request cancelation | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| RFC compliant caching | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | | ||
| Cookies (out-of-box) | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: | :x: | | ||
| Follows redirects | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Retries on failure | :heavy_check_mark: | :x: | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: | | ||
| Progress events | :heavy_check_mark: | :x: | :x: | :heavy_check_mark:\*\*\* | Browser only | :heavy_check_mark: | | ||
| Handles gzip/deflate | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Advanced timeouts | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | | ||
| Timings | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: | :x: | | ||
| Errors with metadata | :heavy_check_mark: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | | ||
| JSON mode | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Custom defaults | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | | ||
| Composable | :heavy_check_mark: | :x: | :x: | :x: | :x: | :heavy_check_mark: | | ||
| Hooks | :heavy_check_mark: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | | ||
| Issues open | [![][gio]][g1] | [![][rio]][r1] | [![][nio]][n1] | [![][kio]][k1] | [![][aio]][a1] | [![][sio]][s1] | | ||
| Issues closed | [![][gic]][g2] | [![][ric]][r2] | [![][nic]][n2] | [![][kic]][k2] | [![][aic]][a2] | [![][sic]][s2] | | ||
| Downloads | [![][gd]][g3] | [![][rd]][r3] | [![][nd]][n3] | [![][kd]][k3] | [![][ad]][a3] | [![][sd]][s3] | | ||
| Coverage | [![][gc]][g4] | [![][rc]][r4] | [![][nc]][n4] | [![][kc]][k4] | [![][ac]][a4] | [![][sc]][s4] | | ||
| Build | [![][gb]][g5] | [![][rb]][r5] | [![][nb]][n5] | [![][kb]][k5] | [![][ab]][a5] | [![][sb]][s5] | | ||
| Bugs | [![][gbg]][g6] | [![][rbg]][r6] | [![][nbg]][n6] | [![][kbg]][k6] | [![][abg]][a6] | [![][sbg]][s6] | | ||
| Dependents | [![][gdp]][g7] | [![][rdp]][r7] | [![][ndp]][n7] | [![][kdp]][k7] | [![][adp]][a7] | [![][sdp]][s7] | | ||
| Install size | [![][gis]][g8] | [![][ris]][r8] | [![][nis]][n8] | [![][kis]][k8] | [![][ais]][a8] | [![][sis]][s8] | | ||
\* It's almost API compatible with the browser `fetch` API.\ | ||
\*\* Need to switch the protocol manually.\ | ||
\*\*\* Currently, only 'DownloadProgress' event is supported, 'UploadProgress' event is not supported.\ | ||
❔ Experimental support. | ||
\*\* Need to switch the protocol manually. Doesn't accept PUSH streams and doesn't reuse HTTP/2 sessions.\ | ||
\*\*\* Currently, only `DownloadProgress` event is supported, `UploadProgress` event is not supported.\ | ||
:grey_question: Experimental support. | ||
@@ -1457,0 +1462,0 @@ <!-- GITHUB --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1623
151072
2192