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

Replace ~ only at the beginning of URL path (eg. "~node") #98

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

hwuethrich
Copy link
Contributor

I've noticed that the first ~ character in the request URL path is replaced by a $ character. I assume this exists to support calling actions exposed by the internal $node service (see here), eg. GET /~node/list is calling the action $node.list.

In our case this causes problems because we have a service exposing database records (using moleculer-db) containing a ~ in their ID and use the following alias:

  aliases: {
    'GET contacts/:id': 'contacts.get'
  }

When calling GET /contacts/ABC~123, the params.id is ABC$123 instead of ABC~123.

I've changed the regex to only replace the tilde from the beginning of the path, but I'm not sure if this breaks some other feature I might have missed.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 370

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.804%

Totals Coverage Status
Change from base Build 369: 0.0%
Covered Lines: 577
Relevant Lines: 592

💛 - Coveralls

1 similar comment
@coveralls
Copy link

coveralls commented Jan 8, 2019

Pull Request Test Coverage Report for Build 370

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.804%

Totals Coverage Status
Change from base Build 369: 0.0%
Covered Lines: 577
Relevant Lines: 592

💛 - Coveralls

@icebob
Copy link
Member

icebob commented Jan 8, 2019

Good PR, thanks!

@icebob icebob merged commit 15d3175 into moleculerjs:master Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants