Change router's `trailing_slash` option
See original GitHub issueHi,
Is there a way to change the trailing_slash
option for the included rest auth URLs?
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Feature request: Normalize trailing slashed by default #8022
Many users have expressed concern that useRouteMatch returns the trailing slash in matching URLs, which makes joining them with path segments unpredictable ...
Read more >Trailing Slash - next.config.js
By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash. For example /about/ will redirect to /about...
Read more >Trailing Slashes and Gatsby - Jon
Reach Router made a choice to ignore trailing slashes completely, therefore eliminating any difference when navigating up the path. Where that ...
Read more >To slash or not to slash | Google Search Central Blog
Historically, it's common for URLs with a trailing slash to indicate a directory, and those without a trailing slash to denote a file:....
Read more >Should You Have a Trailing Slash at the End of URLs? - Ahrefs
If you go to Settings > Permalinks, you can change whether you use a trailing slash if you use a custom structure. /%postname%/...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t even know that it should be an optional setting. What would be the issue with just having the urls always work with or without a slash? For my DRF endpoints I almost always just do this:
r'^endpoint/?$'
instead of the typical:r'^endpoint/$'
Does anyone see any issues with making this change to the url confs?
Yeah there are definitely multiple workarounds on the frontend or the backend. In most all of the projects I’ve worked on the frontend devs tend to want URLs without trailing slashes (it’s kind of the norm outside of the Django world). I find it cleaner to just override the auth urls and remove the trailing slash rather than tell them to use trailing slashes.
Also it’s in Django Rest Framework, and with this being an extension of DRF it would be nice to support trailing slashes in a similar fashion. I’ll be putting together a PR for an optional setting and see what the feedback is. Thanks!