File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,8 +211,8 @@ export const setUrl: {
211211 * @category combinators
212212 */
213213export const prependUrl : {
214- ( path : string ) : ( self : HttpClientRequest ) => HttpClientRequest
215- ( self : HttpClientRequest , path : string ) : HttpClientRequest
214+ ( path : string | URL ) : ( self : HttpClientRequest ) => HttpClientRequest
215+ ( self : HttpClientRequest , path : string | URL ) : HttpClientRequest
216216} = internal . prependUrl
217217
218218/**
Original file line number Diff line number Diff line change @@ -264,19 +264,22 @@ export const appendUrl = dual<
264264
265265/** @internal */
266266export const prependUrl = dual <
267- ( path : string ) => ( self : ClientRequest . HttpClientRequest ) => ClientRequest . HttpClientRequest ,
268- ( self : ClientRequest . HttpClientRequest , path : string ) => ClientRequest . HttpClientRequest
269- > ( 2 , ( self , url ) =>
270- makeInternal (
267+ ( path : string | URL ) => ( self : ClientRequest . HttpClientRequest ) => ClientRequest . HttpClientRequest ,
268+ ( self : ClientRequest . HttpClientRequest , path : string | URL ) => ClientRequest . HttpClientRequest
269+ > ( 2 , ( self , url ) => {
270+ const clone = typeof url === "string" ? url : url . toString ( )
271+
272+ return makeInternal (
271273 self . method ,
272- url . endsWith ( "/" ) && self . url . startsWith ( "/" ) ?
274+ clone . endsWith ( "/" ) && self . url . startsWith ( "/" ) ?
273275 url + self . url . slice ( 1 ) :
274276 url + self . url ,
275277 self . urlParams ,
276278 self . hash ,
277279 self . headers ,
278280 self . body
279- ) )
281+ )
282+ } )
280283
281284/** @internal */
282285export const updateUrl = dual <
You can’t perform that action at this time.
0 commit comments