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

[DO NOT MERGE] global route match bug demo #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zone117x
Copy link

@zone117x zone117x commented Mar 16, 2021

[Do not merge] Only opening a PR here for the CI tests to demostrate the bug.

Global route match syntax cause a parsing error.

For example, when using the route:

  app.get('/test/*', (req, res) => {
    res.sendStatus(200);
  });

The parsing error is thrown:

  ● path-to-regexp › rules › '/test/*' › encountered a declaration exception

    TypeError: Unexpected MODIFIER at 6, expected END

      155 |     if (value !== undefined) return value;
      156 |     const { type: nextType, index } = tokens[i];
    > 157 |     throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}`);
          |           ^
      158 |   };
      159 | 
      160 |   const consumeText = (): string => {

      at mustConsume (src/index.ts:157:11)
      at parse (src/index.ts:228:5)
      at stringToRegexp (src/index.ts:495:25)
      at Object.pathToRegexp (src/index.ts:617:10)
      at Suite.<anonymous> (src/index.spec.ts:2804:33)
      at src/index.spec.ts:2802:7
          at Array.forEach (<anonymous>)
      at Suite.<anonymous> (src/index.spec.ts:2799:11)
      at Suite.<anonymous> (src/index.spec.ts:2798:3)
      at Object.<anonymous> (src/index.spec.ts:2705:1)

See Express documentation for global/wildcard route definitions here:
https://expressjs.com/en/4x/api.html#router.methods

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b5a92ac on zone117x:demo/global-prefix-route-bug into b39edd4 on pillarjs:master.

@zone117x zone117x changed the title [DO NOT MERGE] global prefix route bug demo [DO NOT MERGE] global route match bug demo Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants