question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect params parsing?

See original GitHub issue

With a route like the following, I expect the last :y parameter to not include .mvt but it’s currently reading :y.mvt as my param key and including the string .mvt in the param value.

polka()
  .get('/:z/:x/:y.mvt', async (req, res) => {
    const { params } = req;
    console.log(params.y) // undefined
    console.log(params['y.mvt'] // 'myY.mvt'

    // workaround
    const y = params['y.mvt'].replace('.mvt', '');
    console.log(y) // 'myY'

I’m porting an app over from express that parsed this format as expected. But maybe this URL structure is no good to begin with!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lukeedcommented, Sep 25, 2018

Thanks.

I have a solution here which allows for parsing/matching against any extension-like parameters. This will also apply route filtering.

I’ve not (yet?) published this because it drops 100k to 400k ops/sec in each of the benchmarks. I’ll sit on it & see if a better way comes to mind.

1reaction
mhkellercommented, Dec 11, 2018

Ah thanks! It was a fun one to work on. Very cool. Thanks for continuing to commit the brain cells to this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[@polka/url] Incorrect query params parsing when ... - GitHub
This line decode the url too early causing the encoded & to turn into a param separator. 1
Read more >
Incorrect parsing when using @param ...$var - Drupal
Is getting parsed as type string ... and var $var , rather than string and var ...$var . This results in an errors...
Read more >
Incorrect parsing for connection parameters - CUBA.Platform
Hi Team, The Data Store Porperties editor of Studio can't parse connection parameter containing '/' correctly . Fox example, cuba.
Read more >
URL parameters parsed incorrectly using HTTP/2 connector
I'm using Tomcat 8.5.9. It appears that query strings containing percent encoded ampersand (%26) and percent (%25) characters are not parsed ...
Read more >
Multiple 'path' parameters in flask route lead to incorrect parsing
First it may unquote it and later it has problem to detect ends of paths. You should use char which you will not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found