Comparing version 8.4.24 to 8.4.25
@@ -6,2 +6,3 @@ /// <reference types="node" /> | ||
import type {ProgressStream} from 'progress-stream' | ||
import type {RequestAdapter as RequestAdapter_2} from 'get-it' | ||
import type {UrlWithStringQuery} from 'url' | ||
@@ -13,3 +14,3 @@ | ||
*/ | ||
export declare const adapter: RequestAdapter | ||
export declare const adapter: RequestAdapter_2 | ||
@@ -190,2 +191,3 @@ /** @public */ | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
method?: string | ||
@@ -192,0 +194,0 @@ proxy?: any |
@@ -6,6 +6,7 @@ /// <reference types="node" /> | ||
import type {ProgressStream} from 'progress-stream' | ||
import type {RequestAdapter as RequestAdapter_2} from 'get-it' | ||
import type {UrlWithStringQuery} from 'url' | ||
/** @public */ | ||
export declare const adapter: RequestAdapter | ||
export declare const adapter: RequestAdapter_2 | ||
@@ -186,2 +187,3 @@ /** @public */ | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
method?: string | ||
@@ -188,0 +190,0 @@ proxy?: any |
@@ -6,2 +6,3 @@ /// <reference types="node" /> | ||
import type {ProgressStream} from 'progress-stream' | ||
import type {RequestAdapter as RequestAdapter_2} from 'get-it' | ||
import type {UrlWithStringQuery} from 'url' | ||
@@ -13,3 +14,3 @@ | ||
*/ | ||
export declare const adapter: RequestAdapter | ||
export declare const adapter: RequestAdapter_2 | ||
@@ -190,2 +191,3 @@ /** @public */ | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
method?: string | ||
@@ -192,0 +194,0 @@ proxy?: any |
@@ -1,8 +0,11 @@ | ||
/// <reference types="node" /> | ||
import {FinalizeNodeOptionsPayload} from 'get-it' | ||
import {HookOnRequestEvent} from 'get-it' | ||
import {HttpContext} from 'get-it' | ||
import {MiddlewareChannels} from 'get-it' | ||
import type {MiddlewareHooks} from 'get-it' | ||
import {MiddlewareResponse} from 'get-it' | ||
import {RequestAdapter} from 'get-it' | ||
import {RequestOptions} from 'get-it' | ||
import type {RetryOptions} from 'get-it' | ||
import type {IncomingHttpHeaders} from 'http' | ||
import type {IncomingMessage} from 'http' | ||
import type {ProgressStream} from 'progress-stream' | ||
import type {UrlWithStringQuery} from 'url' | ||
/** | ||
@@ -15,9 +18,2 @@ * This middleware only has an effect in Node.js. | ||
/** @public */ | ||
export declare type ApplyMiddleware = <T extends keyof MiddlewareHooks>( | ||
hook: T, | ||
value: MiddlewareHooks[T] extends (defaultValue: infer V, ...rest: any[]) => any ? V : never, | ||
...args: MiddlewareHooks[T] extends (defaultValue: any, ...rest: infer P) => any ? P : never | ||
) => ReturnType<MiddlewareHooks[T]> | ||
/** @public */ | ||
export declare function base(baseUrl: string): { | ||
@@ -61,23 +57,2 @@ processOptions: (options: RequestOptions) => RequestOptions | ||
/** @public */ | ||
export declare type DefineApplyMiddleware = (middleware: MiddlewareReducer) => ApplyMiddleware | ||
/** | ||
* Reports the environment as either "node" or "browser", depending on what entry point was used to aid bundler debugging. | ||
* If 'browser' is used, then the globally available `fetch` class is used. While `node` will always use either `node:https` or `node:http` depending on the protocol. | ||
* @public | ||
*/ | ||
export declare type ExportEnv = 'node' | 'react-server' | 'browser' | ||
/** @public */ | ||
export declare interface FinalizeNodeOptionsPayload extends UrlWithStringQuery { | ||
method: RequestOptions['method'] | ||
headers: RequestOptions['headers'] | ||
maxRedirects: RequestOptions['maxRedirects'] | ||
agent?: any | ||
cert?: any | ||
key?: any | ||
ca?: any | ||
} | ||
/** @public */ | ||
export declare function headers( | ||
@@ -91,31 +66,2 @@ _headers: any, | ||
/** @public */ | ||
export declare type HookOnRequestEvent = HookOnRequestEventNode | HookOnRequestEventBrowser | ||
/** @public */ | ||
export declare interface HookOnRequestEventBase { | ||
options: RequestOptions | ||
context: HttpContext | ||
request: any | ||
} | ||
/** @public */ | ||
export declare interface HookOnRequestEventBrowser extends HookOnRequestEventBase { | ||
adapter: Omit<RequestAdapter, 'node'> | ||
progress?: undefined | ||
} | ||
/** @public */ | ||
export declare interface HookOnRequestEventNode extends HookOnRequestEventBase { | ||
adapter: 'node' | ||
progress: any | ||
} | ||
/** @public */ | ||
export declare interface HttpContext { | ||
options: RequestOptions | ||
channels: MiddlewareChannels | ||
applyMiddleware: ApplyMiddleware | ||
} | ||
/** @public */ | ||
export declare function httpErrors(): { | ||
@@ -125,17 +71,3 @@ onResponse: (res: MiddlewareResponse, ctx: HttpContext) => MiddlewareResponse | ||
/** | ||
* request-node in node, browser-request in browsers | ||
* @public | ||
*/ | ||
export declare type HttpRequest = ( | ||
context: HttpContext, | ||
callback: (err: Error | null, response?: MiddlewareResponse) => void, | ||
) => HttpRequestOngoing | ||
/** @public */ | ||
export declare interface HttpRequestOngoing { | ||
abort: () => void | ||
} | ||
/** @public */ | ||
export declare function injectResponse(opts?: { | ||
@@ -173,68 +105,2 @@ inject: ( | ||
/** @public */ | ||
export declare type Middleware = Partial<MiddlewareHooks> | ||
/** @public */ | ||
export declare interface MiddlewareChannels { | ||
request: PubSub<HttpContext> | ||
response: PubSub<unknown> | ||
progress: PubSub<unknown> | ||
error: PubSub<unknown> | ||
abort: PubSub<void> | ||
} | ||
/** @public */ | ||
export declare type MiddlewareHookName = keyof MiddlewareHooks | ||
/** @public */ | ||
export declare interface MiddlewareHooks { | ||
processOptions: (options: RequestOptions) => RequestOptions | ||
validateOptions: (options: RequestOptions) => void | undefined | ||
interceptRequest: ( | ||
prevValue: MiddlewareResponse | undefined, | ||
event: { | ||
adapter: RequestAdapter | ||
context: HttpContext | ||
}, | ||
) => MiddlewareResponse | undefined | void | ||
finalizeOptions: ( | ||
options: FinalizeNodeOptionsPayload | RequestOptions, | ||
) => FinalizeNodeOptionsPayload | RequestOptions | ||
onRequest: (evt: HookOnRequestEvent) => void | ||
onResponse: (response: MiddlewareResponse, context: HttpContext) => MiddlewareResponse | ||
onError: (err: Error | null, context: HttpContext) => any | ||
onReturn: (channels: MiddlewareChannels, context: HttpContext) => any | ||
onHeaders: ( | ||
response: IncomingMessage, | ||
evt: { | ||
headers: IncomingHttpHeaders | ||
adapter: RequestAdapter | ||
context: HttpContext | ||
}, | ||
) => ProgressStream | ||
} | ||
/** @public */ | ||
export declare type MiddlewareReducer = { | ||
[T in keyof MiddlewareHooks]: (( | ||
...args: Parameters<MiddlewareHooks[T]> | ||
) => ReturnType<MiddlewareHooks[T]>)[] | ||
} | ||
/** @public */ | ||
export declare interface MiddlewareRequest {} | ||
/** @public */ | ||
export declare interface MiddlewareResponse { | ||
body: any | ||
url: string | ||
method: string | ||
headers: any | ||
statusCode: number | ||
statusMessage: string | ||
} | ||
/** @public */ | ||
export declare type Middlewares = Middleware[] | ||
/** @public */ | ||
export declare function mtls(config?: any): { | ||
@@ -265,2 +131,3 @@ finalizeOptions: (options: RequestOptions | FinalizeNodeOptionsPayload) => | ||
maxRetries?: number | undefined | ||
retryDelay?: ((attemptNumber: number) => number) | undefined | ||
method?: string | undefined | ||
@@ -305,55 +172,2 @@ proxy?: any | ||
/** @public */ | ||
export declare interface PubSub<Message> { | ||
publish: (message: Message) => void | ||
subscribe: (subscriber: Subscriber<Message>) => () => void | ||
} | ||
/** | ||
* Reports the request adapter in use. `node` is only available if `ExportEnv` is also `node`. | ||
* When `ExportEnv` is `browser` then the adapter can be either `xhr` or `fetch`. | ||
* In the future `fetch` will be available in `node` as well. | ||
* @public | ||
*/ | ||
export declare type RequestAdapter = 'node' | 'xhr' | 'fetch' | ||
/** @public */ | ||
export declare type Requester = { | ||
use: (middleware: Middleware) => Requester | ||
clone: () => Requester | ||
(options: RequestOptions | string): any | ||
} | ||
/** @public */ | ||
export declare interface RequestOptions { | ||
url: string | ||
body?: any | ||
bodySize?: number | ||
cancelToken?: any | ||
compress?: boolean | ||
headers?: any | ||
maxRedirects?: number | ||
maxRetries?: number | ||
method?: string | ||
proxy?: any | ||
query?: any | ||
rawBody?: boolean | ||
shouldRetry?: any | ||
stream?: boolean | ||
timeout?: any | ||
tunnel?: boolean | ||
debug?: any | ||
requestId?: number | ||
attemptNumber?: number | ||
withCredentials?: boolean | ||
/** | ||
* Enables using the native `fetch` API instead of the default `http` module, and allows setting its options like `cache` | ||
*/ | ||
fetch?: boolean | Omit<RequestInit, 'method'> | ||
/** | ||
* Some frameworks have special behavior for `fetch` when an `AbortSignal` is used, and may want to disable it unless userland specifically opts-in. | ||
*/ | ||
useAbortSignal?: boolean | ||
} | ||
/** @public */ | ||
export declare const retry: { | ||
@@ -367,14 +181,2 @@ (opts?: Partial<RetryOptions>): { | ||
/** @public */ | ||
export declare interface RetryOptions { | ||
shouldRetry: (err: any, num: number, options: any) => boolean | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
} | ||
/** @public */ | ||
export declare interface Subscriber<Event> { | ||
(event: Event): void | ||
} | ||
/** @public */ | ||
export declare function urlEncoded(): { | ||
@@ -381,0 +183,0 @@ processOptions: (options: RequestOptions) => RequestOptions |
@@ -590,3 +590,3 @@ import { g as getDefaultExportFromCjs } from "./_chunks-es/_commonjsHelpers.js"; | ||
onError: (err, context) => { | ||
const options = context.options, max = options.maxRetries || maxRetries, shouldRetry = options.shouldRetry || allowRetry, attemptNumber = options.attemptNumber || 0; | ||
const options = context.options, max = options.maxRetries || maxRetries, delay = options.retryDelay || retryDelay, shouldRetry = options.shouldRetry || allowRetry, attemptNumber = options.attemptNumber || 0; | ||
if (isStream(options.body) || !shouldRetry(err, attemptNumber, options) || attemptNumber >= max) | ||
@@ -597,3 +597,3 @@ return err; | ||
}); | ||
return setTimeout(() => context.channels.request.publish(newContext), retryDelay(attemptNumber)), null; | ||
return setTimeout(() => context.channels.request.publish(newContext), delay(attemptNumber)), null; | ||
} | ||
@@ -600,0 +600,0 @@ }; |
/// <reference types="node" /> | ||
import {AgentOptions} from 'http' | ||
import {FinalizeNodeOptionsPayload} from 'get-it' | ||
import {HookOnRequestEvent} from 'get-it' | ||
import {HttpContext} from 'get-it' | ||
import {IncomingHttpHeaders} from 'http' | ||
import {IncomingMessage} from 'http' | ||
import type {ProgressStream} from 'progress-stream' | ||
import {MiddlewareChannels} from 'get-it' | ||
import type {MiddlewareHooks} from 'get-it' | ||
import {MiddlewareResponse} from 'get-it' | ||
import progressStream from 'progress-stream' | ||
import type {UrlWithStringQuery} from 'url' | ||
import {RequestAdapter} from 'get-it' | ||
import {RequestOptions} from 'get-it' | ||
import type {RetryOptions} from 'get-it' | ||
@@ -18,9 +25,2 @@ /** | ||
/** @public */ | ||
export declare type ApplyMiddleware = <T extends keyof MiddlewareHooks>( | ||
hook: T, | ||
value: MiddlewareHooks[T] extends (defaultValue: infer V, ...rest: any[]) => any ? V : never, | ||
...args: MiddlewareHooks[T] extends (defaultValue: any, ...rest: infer P) => any ? P : never | ||
) => ReturnType<MiddlewareHooks[T]> | ||
/** @public */ | ||
export declare function base(baseUrl: string): { | ||
@@ -64,23 +64,2 @@ processOptions: (options: RequestOptions) => RequestOptions | ||
/** @public */ | ||
export declare type DefineApplyMiddleware = (middleware: MiddlewareReducer) => ApplyMiddleware | ||
/** | ||
* Reports the environment as either "node" or "browser", depending on what entry point was used to aid bundler debugging. | ||
* If 'browser' is used, then the globally available `fetch` class is used. While `node` will always use either `node:https` or `node:http` depending on the protocol. | ||
* @public | ||
*/ | ||
export declare type ExportEnv = 'node' | 'react-server' | 'browser' | ||
/** @public */ | ||
export declare interface FinalizeNodeOptionsPayload extends UrlWithStringQuery { | ||
method: RequestOptions['method'] | ||
headers: RequestOptions['headers'] | ||
maxRedirects: RequestOptions['maxRedirects'] | ||
agent?: any | ||
cert?: any | ||
key?: any | ||
ca?: any | ||
} | ||
/** @public */ | ||
export declare function headers( | ||
@@ -94,31 +73,2 @@ _headers: any, | ||
/** @public */ | ||
export declare type HookOnRequestEvent = HookOnRequestEventNode | HookOnRequestEventBrowser | ||
/** @public */ | ||
export declare interface HookOnRequestEventBase { | ||
options: RequestOptions | ||
context: HttpContext | ||
request: any | ||
} | ||
/** @public */ | ||
export declare interface HookOnRequestEventBrowser extends HookOnRequestEventBase { | ||
adapter: Omit<RequestAdapter, 'node'> | ||
progress?: undefined | ||
} | ||
/** @public */ | ||
export declare interface HookOnRequestEventNode extends HookOnRequestEventBase { | ||
adapter: 'node' | ||
progress: any | ||
} | ||
/** @public */ | ||
export declare interface HttpContext { | ||
options: RequestOptions | ||
channels: MiddlewareChannels | ||
applyMiddleware: ApplyMiddleware | ||
} | ||
/** @public */ | ||
export declare function httpErrors(): { | ||
@@ -128,17 +78,3 @@ onResponse: (res: MiddlewareResponse, ctx: HttpContext) => MiddlewareResponse | ||
/** | ||
* request-node in node, browser-request in browsers | ||
* @public | ||
*/ | ||
export declare type HttpRequest = ( | ||
context: HttpContext, | ||
callback: (err: Error | null, response?: MiddlewareResponse) => void, | ||
) => HttpRequestOngoing | ||
/** @public */ | ||
export declare interface HttpRequestOngoing { | ||
abort: () => void | ||
} | ||
/** @public */ | ||
export declare function injectResponse(opts?: { | ||
@@ -176,68 +112,2 @@ inject: ( | ||
/** @public */ | ||
export declare type Middleware = Partial<MiddlewareHooks> | ||
/** @public */ | ||
export declare interface MiddlewareChannels { | ||
request: PubSub<HttpContext> | ||
response: PubSub<unknown> | ||
progress: PubSub<unknown> | ||
error: PubSub<unknown> | ||
abort: PubSub<void> | ||
} | ||
/** @public */ | ||
export declare type MiddlewareHookName = keyof MiddlewareHooks | ||
/** @public */ | ||
export declare interface MiddlewareHooks { | ||
processOptions: (options: RequestOptions) => RequestOptions | ||
validateOptions: (options: RequestOptions) => void | undefined | ||
interceptRequest: ( | ||
prevValue: MiddlewareResponse | undefined, | ||
event: { | ||
adapter: RequestAdapter | ||
context: HttpContext | ||
}, | ||
) => MiddlewareResponse | undefined | void | ||
finalizeOptions: ( | ||
options: FinalizeNodeOptionsPayload | RequestOptions, | ||
) => FinalizeNodeOptionsPayload | RequestOptions | ||
onRequest: (evt: HookOnRequestEvent) => void | ||
onResponse: (response: MiddlewareResponse, context: HttpContext) => MiddlewareResponse | ||
onError: (err: Error | null, context: HttpContext) => any | ||
onReturn: (channels: MiddlewareChannels, context: HttpContext) => any | ||
onHeaders: ( | ||
response: IncomingMessage, | ||
evt: { | ||
headers: IncomingHttpHeaders | ||
adapter: RequestAdapter | ||
context: HttpContext | ||
}, | ||
) => ProgressStream | ||
} | ||
/** @public */ | ||
export declare type MiddlewareReducer = { | ||
[T in keyof MiddlewareHooks]: (( | ||
...args: Parameters<MiddlewareHooks[T]> | ||
) => ReturnType<MiddlewareHooks[T]>)[] | ||
} | ||
/** @public */ | ||
export declare interface MiddlewareRequest {} | ||
/** @public */ | ||
export declare interface MiddlewareResponse { | ||
body: any | ||
url: string | ||
method: string | ||
headers: any | ||
statusCode: number | ||
statusMessage: string | ||
} | ||
/** @public */ | ||
export declare type Middlewares = Middleware[] | ||
/** @public */ | ||
export declare function mtls(config?: any): { | ||
@@ -268,2 +138,3 @@ finalizeOptions: (options: RequestOptions | FinalizeNodeOptionsPayload) => | ||
maxRetries?: number | undefined | ||
retryDelay?: ((attemptNumber: number) => number) | undefined | ||
method?: string | undefined | ||
@@ -316,55 +187,2 @@ proxy?: any | ||
/** @public */ | ||
export declare interface PubSub<Message> { | ||
publish: (message: Message) => void | ||
subscribe: (subscriber: Subscriber<Message>) => () => void | ||
} | ||
/** | ||
* Reports the request adapter in use. `node` is only available if `ExportEnv` is also `node`. | ||
* When `ExportEnv` is `browser` then the adapter can be either `xhr` or `fetch`. | ||
* In the future `fetch` will be available in `node` as well. | ||
* @public | ||
*/ | ||
export declare type RequestAdapter = 'node' | 'xhr' | 'fetch' | ||
/** @public */ | ||
export declare type Requester = { | ||
use: (middleware: Middleware) => Requester | ||
clone: () => Requester | ||
(options: RequestOptions | string): any | ||
} | ||
/** @public */ | ||
export declare interface RequestOptions { | ||
url: string | ||
body?: any | ||
bodySize?: number | ||
cancelToken?: any | ||
compress?: boolean | ||
headers?: any | ||
maxRedirects?: number | ||
maxRetries?: number | ||
method?: string | ||
proxy?: any | ||
query?: any | ||
rawBody?: boolean | ||
shouldRetry?: any | ||
stream?: boolean | ||
timeout?: any | ||
tunnel?: boolean | ||
debug?: any | ||
requestId?: number | ||
attemptNumber?: number | ||
withCredentials?: boolean | ||
/** | ||
* Enables using the native `fetch` API instead of the default `http` module, and allows setting its options like `cache` | ||
*/ | ||
fetch?: boolean | Omit<RequestInit, 'method'> | ||
/** | ||
* Some frameworks have special behavior for `fetch` when an `AbortSignal` is used, and may want to disable it unless userland specifically opts-in. | ||
*/ | ||
useAbortSignal?: boolean | ||
} | ||
/** @public */ | ||
export declare const retry: { | ||
@@ -378,14 +196,2 @@ (opts?: Partial<RetryOptions>): { | ||
/** @public */ | ||
export declare interface RetryOptions { | ||
shouldRetry: (err: any, num: number, options: any) => boolean | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
} | ||
/** @public */ | ||
export declare interface Subscriber<Event> { | ||
(event: Event): void | ||
} | ||
/** @public */ | ||
export declare function urlEncoded(): { | ||
@@ -392,0 +198,0 @@ processOptions: (options: RequestOptions) => RequestOptions |
@@ -780,3 +780,3 @@ import { Agent } from "http"; | ||
onError: (err, context) => { | ||
const options = context.options, max = options.maxRetries || maxRetries, shouldRetry = options.shouldRetry || allowRetry, attemptNumber = options.attemptNumber || 0; | ||
const options = context.options, max = options.maxRetries || maxRetries, delay = options.retryDelay || retryDelay, shouldRetry = options.shouldRetry || allowRetry, attemptNumber = options.attemptNumber || 0; | ||
if (isStream(options.body) || !shouldRetry(err, attemptNumber, options) || attemptNumber >= max) | ||
@@ -787,3 +787,3 @@ return err; | ||
}); | ||
return setTimeout(() => context.channels.request.publish(newContext), retryDelay(attemptNumber)), null; | ||
return setTimeout(() => context.channels.request.publish(newContext), delay(attemptNumber)), null; | ||
} | ||
@@ -790,0 +790,0 @@ }; |
{ | ||
"name": "get-it", | ||
"version": "8.4.24", | ||
"version": "8.4.25", | ||
"description": "Generic HTTP request library for node, browsers and workers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -18,3 +18,2 @@ export * from './middleware/agent/browser-agent' | ||
export * from './middleware/urlEncoded' | ||
export type * from './types' | ||
@@ -21,0 +20,0 @@ import {agent} from './middleware/agent/browser-agent' |
@@ -18,3 +18,2 @@ export * from './middleware/agent/node-agent' | ||
export * from './middleware/urlEncoded' | ||
export type * from './types' | ||
@@ -21,0 +20,0 @@ import {agent} from './middleware/agent/node-agent' |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ const leadingSlash = /^\// |
import debugIt from 'debug' | ||
import type {Middleware} from 'get-it' | ||
import type {Middleware} from '../types' | ||
const SENSITIVE_HEADERS = ['cookie', 'authorization'] | ||
@@ -6,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type {MiddlewareHooks, RequestOptions} from '../types' | ||
import type {MiddlewareHooks, RequestOptions} from 'get-it' | ||
@@ -3,0 +3,0 @@ const isReactNative = typeof navigator === 'undefined' ? false : navigator.product === 'ReactNative' |
@@ -1,2 +0,2 @@ | ||
import type {MiddlewareHooks} from '../types' | ||
import type {MiddlewareHooks} from 'get-it' | ||
@@ -3,0 +3,0 @@ const validUrl = /^https?:\/\//i |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ class HttpError extends Error { |
@@ -1,2 +0,2 @@ | ||
import type {Middleware, MiddlewareHooks, MiddlewareResponse} from '../types' | ||
import type {Middleware, MiddlewareHooks, MiddlewareResponse} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -1,2 +0,3 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
import {isBuffer} from '../util/isBuffer' | ||
@@ -3,0 +4,0 @@ import {isPlainObject} from '../util/isPlainObject' |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -1,2 +0,3 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
import {isBrowserOptions} from '../util/isBrowserOptions' | ||
@@ -3,0 +4,0 @@ |
@@ -1,2 +0,3 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
import global from '../util/global' | ||
@@ -3,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -0,5 +1,4 @@ | ||
import type {Middleware} from 'get-it' | ||
import progressStream from 'progress-stream' | ||
import type {Middleware} from '../../types' | ||
function normalizer(stage: 'download' | 'upload') { | ||
@@ -6,0 +5,0 @@ return (prog: any) => ({ |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -1,2 +0,2 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
@@ -3,0 +3,0 @@ /** @public */ |
@@ -1,2 +0,3 @@ | ||
import type {RetryOptions} from '../../types' | ||
import type {RetryOptions} from 'get-it' | ||
import defaultShouldRetry from '../../util/browser-shouldRetry' | ||
@@ -3,0 +4,0 @@ import sharedRetry from './shared-retry' |
@@ -1,2 +0,3 @@ | ||
import type {RetryOptions} from '../../types' | ||
import type {RetryOptions} from 'get-it' | ||
import defaultShouldRetry from '../../util/node-shouldRetry' | ||
@@ -3,0 +4,0 @@ import sharedRetry from './shared-retry' |
@@ -1,2 +0,2 @@ | ||
import type {Middleware, RetryOptions} from '../../types' | ||
import type {Middleware, RetryOptions} from 'get-it' | ||
@@ -16,2 +16,3 @@ const isStream = (stream: any) => | ||
const max = options.maxRetries || maxRetries | ||
const delay = options.retryDelay || retryDelay | ||
const shouldRetry = options.shouldRetry || allowRetry | ||
@@ -36,3 +37,3 @@ const attemptNumber = options.attemptNumber || 0 | ||
// Wait a given amount of time before doing the request again | ||
setTimeout(() => context.channels.request.publish(newContext), retryDelay(attemptNumber)) | ||
setTimeout(() => context.channels.request.publish(newContext), delay(attemptNumber)) | ||
@@ -39,0 +40,0 @@ // Signal that we've handled the error and that it should not propagate further |
@@ -1,2 +0,3 @@ | ||
import type {Middleware} from '../types' | ||
import type {Middleware} from 'get-it' | ||
import {isBuffer} from '../util/isBuffer' | ||
@@ -3,0 +4,0 @@ import {isPlainObject} from '../util/isPlainObject' |
@@ -0,4 +1,4 @@ | ||
import type {HttpRequest, MiddlewareResponse, RequestAdapter, RequestOptions} from 'get-it' | ||
import parseHeaders from 'parse-headers' | ||
import type {HttpRequest, MiddlewareResponse, RequestAdapter, RequestOptions} from '../types' | ||
import {FetchXhr} from './browser/fetchXhr' | ||
@@ -5,0 +5,0 @@ |
import decompressResponse from 'decompress-response' | ||
import follow, {type FollowResponse, type RedirectableRequest} from 'follow-redirects' | ||
import type { | ||
FinalizeNodeOptionsPayload, | ||
HttpRequest, | ||
MiddlewareResponse, | ||
RequestAdapter, | ||
} from 'get-it' | ||
import http from 'http' | ||
@@ -11,8 +17,2 @@ import https from 'https' | ||
import type { | ||
FinalizeNodeOptionsPayload, | ||
HttpRequest, | ||
MiddlewareResponse, | ||
RequestAdapter, | ||
} from '../types' | ||
import {lowerCaseHeaders} from '../util/lowerCaseHeaders' | ||
@@ -19,0 +19,0 @@ import {getProxyOptions, rewriteUriForProxy} from './node/proxy' |
@@ -15,2 +15,3 @@ import type {IncomingHttpHeaders, IncomingMessage} from 'http' | ||
maxRetries?: number | ||
retryDelay?: (attemptNumber: number) => number | ||
method?: string | ||
@@ -17,0 +18,0 @@ proxy?: any |
@@ -1,2 +0,2 @@ | ||
import type {RequestOptions} from '../types' | ||
import type {RequestOptions} from 'get-it' | ||
@@ -3,0 +3,0 @@ export function isBrowserOptions(options: unknown): options is RequestOptions { |
@@ -1,2 +0,2 @@ | ||
import type {ApplyMiddleware, MiddlewareReducer} from '../types' | ||
import type {ApplyMiddleware, MiddlewareReducer} from 'get-it' | ||
@@ -3,0 +3,0 @@ export const middlewareReducer = (middleware: MiddlewareReducer) => |
// Code borrowed from https://github.com/bjoerge/nano-pubsub | ||
import type {PubSub, Subscriber} from '../types' | ||
import type {PubSub, Subscriber} from 'get-it' | ||
@@ -5,0 +5,0 @@ export function createPubSub<Message = void>(): PubSub<Message> { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
738734
7757