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

Route paths are empty when model is mounted at / #487

Open
getsnoopy opened this issue Oct 13, 2022 · 0 comments · May be fixed by #488
Open

Route paths are empty when model is mounted at / #487

getsnoopy opened this issue Oct 13, 2022 · 0 comments · May be fixed by #488
Labels

Comments

@getsnoopy
Copy link

Steps to reproduce

  1. Set up a model where the http.path property is set to /.
  2. Open Loopback Explorer (the Swagger UI).
  3. See that the page fails to load.

Current Behavior

The addRoute subfunction in the RestAdapter.allRoutes method has a bug where it doesn't account for the case where the path of a route is just /, so when the trailing slash removal code runs, it makes the path empty instead of keeping it at /.

Expected Behavior

If the path is /, the trailing slash removal code should leave it unchanged.

Additional information

linux x64 12.22.12
├── loopback@3.27.0
├── loopback-boot@2.28.0
├── loopback-component-explorer@6.5.1
├── loopback-component-storage@3.7.0
├── loopback-connector-postgresql@3.9.1
@getsnoopy getsnoopy added the bug label Oct 13, 2022
getsnoopy added a commit to getsnoopy/strong-remoting that referenced this issue Oct 13, 2022
Previously, there was a bug in RestAdapter.allRoutes where the paths for
routes which were mounted at / would return as empty instead of the
expected / because of some trailing slash removal logic that was faulty.
This commit fixes this so that it accounts for cases where the path
itself is /, so the logic will leave those unchanged.

Fixes strongloop#487
@getsnoopy getsnoopy linked a pull request Oct 13, 2022 that will close this issue
4 tasks
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 a pull request may close this issue.

1 participant