got-fetch icon indicating copy to clipboard operation
got-fetch copied to clipboard

prefixUrl is ignored causing URL building to fail

Open Mnkras opened this issue 1 year ago • 1 comments

In fetch.ts there is this code: const url = new URL(typeof input === 'string' ? input : input.url); that assumes that the input will always be a full URL or object with a full URL. That is an incorrect assumption and breaks got clients using prefixUrl since input is just a path (/something)

It seems all this logic is to merge query params which references this got bug: https://github.com/sindresorhus/got/issues/1188 Since it is now resolved, do we still need this code?

Can we remove this extra parsing?

Mnkras avatar Aug 01 '23 18:08 Mnkras

Based on #370, restoring the deleted test and running it against the new code (that doesn't separate search params) still fails so I think we still need the code. I have made suggestion to make both prefixUrl and searchParams merging work together.

alexghr avatar Aug 02 '23 08:08 alexghr