Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions types/node-fetch/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
// Andrew Leedham <https://github.com/AndrewLeedham>
// Jason Li <https://github.com/JasonLi914>
// Brandon Wilson <https://github.com/wilsonianb>
// Steve Faulkner <https://github.com/southpolesteve>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />

import { Agent } from "http";
import { URLSearchParams } from "url";
import { URLSearchParams, URL } from "url";
import { AbortSignal } from "./externals";

export class Request extends Body {
Expand All @@ -26,7 +27,7 @@ export class Request extends Body {
url: string;

// node-fetch extensions to the whatwg/fetch spec
agent?: Agent;
agent?: Agent | ((parsedUrl: URL) => Agent);
compress: boolean;
counter: number;
follow: number;
Expand Down
3 changes: 2 additions & 1 deletion types/node-fetch/node-fetch-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fetch, {
Response,
FetchError
} from "node-fetch";
import { URL } from "url";
import { Agent } from "http";

function test_fetchUrlWithOptions() {
Expand Down Expand Up @@ -73,7 +74,7 @@ function test_fetchUrlWithRequestObject() {
);
const timeout: number = request.timeout;
const size: number = request.size;
const agent: Agent | undefined = request.agent;
const agent: Agent | ((parsedUrl: URL) => Agent) | undefined = request.agent;
const protocol: string = request.protocol;

handlePromise(fetch(request));
Expand Down