Skip to content

Commit dad7e6e

Browse files
Merge pull request #899 from goodeggs/types/add-missing-agent-option
types: add missing agent option
2 parents 256644c + e3473c3 commit dad7e6e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-fetch",
3-
"version": "9.0.5",
3+
"version": "9.0.6",
44
"description": "A wrapper around ES6 fetch to simplify interacting with JSON APIs.",
55
"author": "Good Eggs <[email protected]>",
66
"contributors": [

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import 'isomorphic-fetch';
2+
3+
import {Agent} from 'http';
24
import promiseRetry from 'promise-retry';
35

46
import getRequestOptions from './get_request_options';
57

68
export type ShouldRetry = (responseOrError: Response | Error) => boolean;
79

810
export interface JsonFetchOptions extends Omit<RequestInit, 'body'> {
11+
// node-fetch extensions (not available in browsers, i.e. whatwg-fetch) –
12+
// see https://github.com/node-fetch/node-fetch/blob/8721d79208ad52c44fffb4b5b5cfa13b936022c3/%40types/index.d.ts#L76:
13+
agent?: Agent | ((parsedUrl: URL) => Agent);
14+
15+
// goodeggs-fetch options:
916
body?: Record<string, unknown>;
1017
shouldRetry?: (responseOrError: Response | Error) => boolean;
1118
retry?: Parameters<typeof promiseRetry>[0];

0 commit comments

Comments
 (0)