In "next" branch, reg.query got decoded twice!!!
using this as server:
const polka = require('polka')
polka()
.get('/', (req, res) => {
res.end(JSON.stringify(req.query))
}).listen(8181, err => {
if (err) throw err
console.log(`Polka listening on port 8181`)
})
and "curling" it:
curl -v "http://127.0.0.1:8181/?i=TU10Z&n=smsitfix2&Q=%2b393383123549"
we got:
{"i":"TU10Z","n":"smsitfix2","Q":" 393383123549"}
instead of:
{"i":"TU10Z","n":"smsitfix2","Q":"+393383123549"}
may be @polka/url must not decode eagerly the url ...
Ah, you're right. Thanks!
The @olka/url decodes it initially, and then passing req.query (string) thru querystring.parse will re-decode it again.
I'll push out a fix for this tonight :)
Took the opportunity to basically rewrite @polka/url & made it much faster in the process, haha
Closing this since it's pertinent to next specifically, and there's now a new version up.
Thanks!
Most helpful comment
Took the opportunity to basically rewrite
@polka/url& made it much faster in the process, hahaClosing this since it's pertinent to
nextspecifically, and there's now a new version up.Thanks!