NodeError: Request path contains unescaped characters
See original GitHub issueForgive me if this has already been brought up, but I couldn’t find any previous issue about it.
Try going to example.com
and opening up the console and running this:
await fetch("http://example.com?foo=网").then(r => r.text());
No error, all is well.
Now check out this runkit example.
Here’s the error:
NodeError: Request path contains unescaped characters
at new ClientRequest in core _http_client.js — line 114
at http.get in core http.js — line 41
in node-fetch/lib/index.js — line 1327
at new Promise in core — line 0
at Object.fetch in node-fetch/lib/index.js — line 1319
I guess the browser spec of fetch automatically escapes characters or something? I’m not sure as I haven’t looking into it. It would be nice if there were consistency here in any case.
EDIT: This error doesn’t occur in Node.js 8.x (only 10.x), so I guess there was a change in the http/https libs or something.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
Request path contains unescaped characters, how can I fix ...
Your "path" variable contains space. path: ' /users/'+ username +'/repos', ... In my case, the data included unescaped characters such as '…
Read more >TypeError: Request path contains unescaped characters
TypeError: Request path contains unescaped characters I have searched for similar issues but have not found anything too similar to this.
Read more >Request path contains unescaped characters 해결
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters at new NodeError (node:internal/errors:371:5) at new ...
Read more >Deploy failed - Request path contains unescaped characters
I'm now getting a deploy failed while trying to build my site. “Request path contains unescaped characters”. My thinking is that some slug ......
Read more >APA Dictionary of Psychology
... Request path contains unescaped characters"," at new NodeError ... at new ClientRequest (_http_client.js:155:13)"," at request (http.js:94:10)"," at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Greetings,
I never disputed whether v6 is supported or not; v6 retired from active LTS as “maintenance” LTS with v8 labeled as the current “active” LTS version. The matter still stands that, the fact that node v11.x, a version 5 major semver releases ahead of v6, is already available as nightly and has a pending official release date, goes to show how significant the fact that v6 transitioned away from active LTS is, and how important a timely response to this issue is.
~William
I am closing this as a duplicate of #245
For future reader: use
require('url').URL
to construct a url object and pass it to node-fetch, which will auto escape url for you.