@@ -4,6 +4,7 @@ import { IncomingHttpHeaders } from 'http2'
44import * as https from 'node:https'
55import { AddressInfo } from 'net'
66import { expectType } from 'tsd'
7+ import { Agent , Client , Dispatcher , Pool } from 'undici'
78import replyFrom , { FastifyReplyFromOptions } from '..'
89// @ts -ignore
910import tap from 'tap'
@@ -158,6 +159,34 @@ async function main () {
158159 } )
159160 await undiciInstance . ready ( )
160161
162+ const undiciInstanceAgent = fastify ( )
163+ undiciInstance . register ( replyFrom , {
164+ base : 'http://example2.com' ,
165+ undici : new Agent ( )
166+ } )
167+ await undiciInstanceAgent . ready ( )
168+
169+ const undiciInstancePool = fastify ( )
170+ undiciInstance . register ( replyFrom , {
171+ base : 'http://example2.com' ,
172+ undici : new Pool ( 'http://example2.com' )
173+ } )
174+ await undiciInstancePool . ready ( )
175+
176+ const undiciInstanceClient = fastify ( )
177+ undiciInstance . register ( replyFrom , {
178+ base : 'http://example2.com' ,
179+ undici : new Client ( 'http://example2.com' )
180+ } )
181+ await undiciInstanceClient . ready ( )
182+
183+ const undiciInstanceDispatcher = fastify ( )
184+ undiciInstance . register ( replyFrom , {
185+ base : 'http://example2.com' ,
186+ undici : new Dispatcher ( )
187+ } )
188+ await undiciInstanceDispatcher . ready ( )
189+
161190 tap . pass ( 'done' )
162191 tap . end ( )
163192}
0 commit comments