Open xelaris opened 1 year ago
httpxy 0.1.5 node 20 (but doesn't really matter)
not needed, I think
If the server responds with a relativ URL in the Location header (e.g. in case of 201 Created), it causes an "Uncaught TypeError: Invalid URL" error, since there is no second parameter to the URL constructor in: https://github.com/unjs/httpxy/blob/1f62fffb141e905a398f55eb34bd75366082ca3c/src/middleware/web-outgoing.ts#L38
For example:
HTTP/1.1 201 Created Location: /api/books/1
The Location response header is allowed to contain a relativ URL, according to: https://www.rfc-editor.org/rfc/rfc9110#field.location
The URL constructor needs a base argument in that case: https://nodejs.org/api/url.html#new-urlinput-base
base
No response
Environment
httpxy 0.1.5 node 20 (but doesn't really matter)
Reproduction
not needed, I think
Describe the bug
If the server responds with a relativ URL in the Location header (e.g. in case of 201 Created), it causes an "Uncaught TypeError: Invalid URL" error, since there is no second parameter to the URL constructor in: https://github.com/unjs/httpxy/blob/1f62fffb141e905a398f55eb34bd75366082ca3c/src/middleware/web-outgoing.ts#L38
For example:
Additional context
The Location response header is allowed to contain a relativ URL, according to: https://www.rfc-editor.org/rfc/rfc9110#field.location
The URL constructor needs a
base
argument in that case: https://nodejs.org/api/url.html#new-urlinput-baseLogs
No response