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

Docs: Clarify that DefaultDataServiceConfig.trailingSlashEndpoints also removes leading slashes #3689

Closed
1 of 2 tasks
coder925 opened this issue Dec 1, 2022 · 0 comments · Fixed by #3690
Closed
1 of 2 tasks

Comments

@coder925
Copy link
Contributor

coder925 commented Dec 1, 2022

Information

Current documentation for the property trailingSlashEndpoints?: boolean is:

to keep trailing slashes or not; false by default

but should be

to keep leading/trailing slashes or not; false by default

How I noticed this?

My app API is at:

My app has different URLs for each language:

Using ngrx/data, this configuration should work for all languages:

const defaultDataServiceConfig: DefaultDataServiceConfig = {
  root: '/api'
}

but as the leading slash was removed it became relative and only the English app worked. The Norwegian app would try to find the API at https://localhost/nb/api . To fix the issue I had to add:

const defaultDataServiceConfig: DefaultDataServiceConfig = {
  root: '/api',
  trailingSlashEndpoints: true
}

I was using version 14.3.2.

Code file reference

The code file that removes the slashes:

/** Remove leading & trailing spaces or slashes */

Documentation page

https://ngrx.io/api/data/DefaultDataServiceConfig

I would be willing to submit a PR to fix this issue

  • Yes
  • No
coder925 added a commit to coder925/platform that referenced this issue Dec 1, 2022
explain that trailingSlashEndpoints also removed leading slahses.

Closes ngrx#3689
coder925 added a commit to coder925/platform that referenced this issue Dec 2, 2022
explain that trailingSlashEndpoints also removed leading slahses.

Closes ngrx#3689
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant