-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Is it possible to prevent the default URL decoding? #167
Comments
I was running some experiments and found a weird behavior when I used The URL decoding is not happening, when an arrow function is used. More details below, Snippet1: const polka = require("polka");
const app = polka();
const parseUrl = require('@polka/url');
app.parse = parseUrl; // #5
app.use((req, res, next) => {
console.log(req.url); // /proxy_path?query=Ngig+
next();
});
app.listen(5000, () => {
console.log('server listening on 5000');
}); Snippet2: (changes in line:5) const polka = require("polka");
const app = polka();
const parseUrl = require('@polka/url');
app.parse = (req) => parseUrl(req); // #5
app.use((req, res, next) => {
console.log(req.url); // /proxy_path?query=Ngig%2B
next();
});
app.listen(5000, () => {
console.log('server listening on 5000');
}); The results should be consistent and this issue should be fixed. Another note is that, if the |
This is by design, see https://github.com/lukeed/polka#parsereq & you can search for other parse/decode issues in the repo. By default, decoding is enabled because 99.9% of applications want/need this. You didn't mention what version you're using, but I imagine it's a Either way, this is working as intended and not an issue. And the |
Hey @lukeed, thanks for the response. It makes sense now. Yes, I was using the In the Thanks :) |
The percent encodings (such as %2B) are decoded automatically when a request is received in the
polka
server.Original request URL:
http://localhost:5000/proxy_path?query=N4IgLgng%2B
Received request URL:
http://localhost:5000/proxy_path?query=N4IgLgng+
I don't want the URL decoding to happen automatically as I want to proxy the original request as such to a different server. How can I achieve this?
Sample server code:
The text was updated successfully, but these errors were encountered: