Skip to content

Commit

Permalink
Merge pull request #899 from goodeggs/types/add-missing-agent-option
Browse files Browse the repository at this point in the history
types: add missing agent option
  • Loading branch information
jonasgraterol authored Sep 24, 2021
2 parents 256644c + e3473c3 commit dad7e6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"contributors": [
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import 'isomorphic-fetch';

import {Agent} from 'http';
import promiseRetry from 'promise-retry';

import getRequestOptions from './get_request_options';

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

export interface JsonFetchOptions extends Omit<RequestInit, 'body'> {
// 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<string, unknown>;
shouldRetry?: (responseOrError: Response | Error) => boolean;
retry?: Parameters<typeof promiseRetry>[0];
Expand Down

0 comments on commit dad7e6e

Please sign in to comment.