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

params.id undefined when used in middleware parameter #407

Closed
petermikitsh opened this issue Sep 14, 2016 · 4 comments
Closed

params.id undefined when used in middleware parameter #407

petermikitsh opened this issue Sep 14, 2016 · 4 comments
Assignees

Comments

@petermikitsh
Copy link
Contributor

module.exports = function () {
  const app = this;

  app.use('/foo/:id', {
    create(data, params) {
      console.log(params.id); // problem
   }
}

Expected result:

if I go to POST /foo/bar, params.id should be bar.

Actual result:

params.id is undefined.

Monkeypatch:

Don't use id. Using any other value for the parameter seems to work.

@daffl
Copy link
Member

daffl commented Sep 14, 2016

It's because :id route is already defined here. I guess we could rename it to something less likely to clash, maybe __feathersId.

@petermikitsh
Copy link
Contributor Author

Something obscure would be preferable. I could imagine others may have attempted to use an :id parameter.

@petermikitsh
Copy link
Contributor Author

Thanks @daffl! 👍

@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants