diff --git a/package.json b/package.json index 1b640a08..7230f044 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "json-fetch", - "version": "9.0.5", + "version": "9.0.6", "description": "A wrapper around ES6 fetch to simplify interacting with JSON APIs.", "author": "Good Eggs ", "contributors": [ diff --git a/src/index.ts b/src/index.ts index ef223099..01707567 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,6 @@ import 'isomorphic-fetch'; + +import {Agent} from 'http'; import promiseRetry from 'promise-retry'; import getRequestOptions from './get_request_options'; @@ -6,6 +8,11 @@ import getRequestOptions from './get_request_options'; export type ShouldRetry = (responseOrError: Response | Error) => boolean; export interface JsonFetchOptions extends Omit { + // node-fetch extensions (not available in browsers, i.e. whatwg-fetch) – + // see https://github.com/node-fetch/node-fetch/blob/8721d79208ad52c44fffb4b5b5cfa13b936022c3/%40types/index.d.ts#L76: + agent?: Agent | ((parsedUrl: URL) => Agent); + + // goodeggs-fetch options: body?: Record; shouldRetry?: (responseOrError: Response | Error) => boolean; retry?: Parameters[0];