Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 FIX: Import undici types change #422

Merged
merged 1 commit into from Nov 25, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/HttpAgent.ts
Expand Up @@ -3,15 +3,15 @@ import { LookupFunction, isIP } from 'net';
import {
Agent,
} from 'undici';
import { DispatchHandlers } from 'undici/types/dispatcher';
import { BuildOptions } from 'undici/types/connector';
import type Dispatcher from 'undici/types/dispatcher';
import type buildConnector from 'undici/types/connector';

export type CheckAddressFunction = (ip: string, family: number | string) => boolean;

export type HttpAgentOptions = {
lookup?: LookupFunction;
checkAddress?: CheckAddressFunction;
connect?: BuildOptions,
connect?: buildConnector.BuildOptions,
};

class IllegalAddressError extends Error {
Expand Down Expand Up @@ -51,7 +51,7 @@ export class HttpAgent extends Agent {
this.#checkAddress = options.checkAddress;
}

dispatch(options: Agent.DispatchOptions, handler: DispatchHandlers): boolean {
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean {
if (this.#checkAddress && options.origin) {
const originUrl = typeof options.origin === 'string' ? new URL(options.origin) : options.origin;
let hostname = originUrl.hostname;
Expand Down
5 changes: 1 addition & 4 deletions src/Request.ts
@@ -1,14 +1,11 @@
import { Readable, Writable } from 'stream';
import { IncomingHttpHeaders } from 'http';
import type {
HttpMethod as UndiciHttpMethod,
} from 'undici/types/dispatcher';
import type Dispatcher from 'undici/types/dispatcher';
import type {
HttpClientResponse,
} from './Response';

export type HttpMethod = UndiciHttpMethod;
export type HttpMethod = Dispatcher.HttpMethod;

export type RequestURL = string | URL;

Expand Down