Skip to content

Commit a0e76c7

Browse files
authored
fix(types): add missing DNS interceptor (#4024)
1 parent e260e7b commit a0e76c7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

test/types/interceptor.test-d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {expectAssignable} from "tsd";
22
import Undici from "../..";
33
import Dispatcher from "../../types/dispatcher";
4+
import Interceptors from "../../types/interceptors";
45

56
expectAssignable<Dispatcher.DispatchInterceptor>(Undici.createRedirectInterceptor({ maxRedirections: 3 }))
7+
8+
expectAssignable<Dispatcher.ComposedDispatcher>(new Dispatcher().compose([Interceptors.dns({maxTTL: 2_000})]));
9+

types/interceptors.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ declare namespace Interceptors {
2828
export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
2929
export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
3030
export function responseError(opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31+
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
3132
}

0 commit comments

Comments
 (0)