Skip to content

Commit

Permalink
Urls with query string are not working correctly. This fixes it.
Browse files Browse the repository at this point in the history
From Node documentation:

path <string> Request path. Should include query string if any. E.G.
'/index.html?page=12'. An exception is thrown when the request path
contains illegal characters. Currently, only spaces are rejected but
that may change in the future. Default: '/'.
  • Loading branch information
ombr committed Jun 7, 2021
1 parent f9cd3eb commit dfcc18f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/polyfill/fetch-node.mjs
Expand Up @@ -17,11 +17,11 @@ if (!global.fetch) {
const httpsPromise = dynamicImport('https', https => https)

setFetch(function(url, {headers} = {}) {
let {port, hostname, pathname, protocol} = new URL(url)
let {port, hostname, pathname, protocol, search} = new URL(url)
const options = {
method: 'GET',
hostname,
path: encodeURI(pathname),
path: encodeURI(pathname) + search,
headers
}
if (port !== '') options.port = Number(port)
Expand Down

0 comments on commit dfcc18f

Please sign in to comment.