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

Ensures that mounted routers have a leading slash #501

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

atheriel
Copy link
Contributor

This should fix #476. Since Plumber already ensures that there is a trailing slash, this just does the same for a leading slash as well, rather than issue an error (which was the other suggested solution).

The examples from that thread now work correctly.

PR task list:

  • Update NEWS
  • Add tests
  • Update documentation with devtools::document()

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2019

CLA assistant check
All committers have signed the CLA.

@schloerke schloerke self-requested a review October 28, 2019 16:47
@schloerke schloerke requested a review from wch October 28, 2019 16:47
R/plumber.R Outdated Show resolved Hide resolved
tests/testthat/test-plumber.R Outdated Show resolved Hide resolved
@atheriel atheriel force-pushed the fill-in-leading-slash-for-mounts branch from dc13db6 to 2d5fb16 Compare November 1, 2019 21:11
This also adds some small tests for correct handling of both leading and
trailing slashes in mount paths.

Co-authored-by: Winston Chang <winston@stdout.org>
@atheriel atheriel force-pushed the fill-in-leading-slash-for-mounts branch from 2d5fb16 to 06c3275 Compare November 1, 2019 21:19
@atheriel
Copy link
Contributor Author

atheriel commented Nov 1, 2019

Should be good to go now. I added some additional tests and moved to using startsWith() and endsWith() instead of a regex. I've listed @wch as a co-author on the commit, since he basically composed the new solution.

@schloerke schloerke merged commit 54fc7f7 into rstudio:master Nov 14, 2019
@atheriel atheriel deleted the fill-in-leading-slash-for-mounts branch November 14, 2019 19:46
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.

Mounted routers should require a slash for route location
4 participants