Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters #146

Closed
DevYukine opened this issue Mar 8, 2018 · 1 comment

Comments

@DevYukine
Copy link

DevYukine commented Mar 8, 2018

Using this piece of code

const Kitsu = require('kitsu');
const kitsu = new Kitsu();
const { data } = await kitsu.fetch('anime', { filter: { name: "Attack On Titan"} });

(used inside an async function) throws following error

senpai_1    | [2018-03-08 12:27:30] [0] TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
senpai_1    | [2018-03-08 12:27:30] [0]     at new ClientRequest (_http_client.js:127:13)
senpai_1    | [2018-03-08 12:27:30] [0]     at Object.request (https.js:275:10)
senpai_1    | [2018-03-08 12:27:30] [0]     at RedirectableRequest._performRequest (/usr/src/Senpai/node_modules/follow-redirects/index.js:128:24)
senpai_1    | [2018-03-08 12:27:30] [0]     at new RedirectableRequest (/usr/src/Senpai/node_modules/follow-redirects/index.js:54:8)
senpai_1    | [2018-03-08 12:27:30] [0]     at Object.wrappedProtocol.request (/usr/src/Senpai/node_modules/follow-redirects/index.js:252:14)
senpai_1    | [2018-03-08 12:27:30] [0]     at dispatchHttpRequest (/usr/src/Senpai/node_modules/axios/lib/adapters/http.js:141:25)
senpai_1    | [2018-03-08 12:27:30] [0]     at new Promise (<anonymous>)
senpai_1    | [2018-03-08 12:27:30] [0]     at httpAdapter (/usr/src/Senpai/node_modules/axios/lib/adapters/http.js:18:10)
senpai_1    | [2018-03-08 12:27:30] [0]     at dispatchRequest (/usr/src/Senpai/node_modules/axios/lib/core/dispatchRequest.js:59:10)
senpai_1    | [2018-03-08 12:27:30] [0]     at <anonymous>

and im pretty sure that this piece of code is correct 🤔 would appreciate some information how i would go about fixing this issue

@wopian
Copy link
Owner

wopian commented Mar 8, 2018

Thanks for making me aware of this! Seems axios itself doesn't handle character escaping - it passes it to XHR in browser that does do this automatically, but http in node expects you to do it yourself.

Fixed this in e4210fc and released in 5.0.6 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants