Skip to content

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

@getsnoopy

Description

@getsnoopy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions