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

Normalize trailing slash for collection on self links #391

Open
vnen opened this issue Mar 24, 2018 · 1 comment
Open

Normalize trailing slash for collection on self links #391

vnen opened this issue Mar 24, 2018 · 1 comment

Comments

@vnen
Copy link

vnen commented Mar 24, 2018

It's usual for collections to end the URL with a trailing slash. I know the server answers the same way to requests with and without a trailing slash (and that is good), but I would like to always show the trailing slash in the self link when referring to collections.

The spec doesn't touch this point, but I believe the self link should always be the same for the same resource. Right now it only reflects whatever the client has requested. So a request to /articles results in "self": "/articles" and a request to /articles/ results in "self": "/articles/". They have a different link but refers to the same collection.

This also complicates my integration tests, because I have to be consistent when making the requests to always use the trailing slash, otherwise I'll have a false alarm.

My proposal is to always use the trailing slash for collections (since they are akin to directories in a filesystem) and always show that in the self link, even if the server responds to both addresses. I'm okay with removing the trailing slash too, but at least be consistent.

@pmcnr-hx
Copy link
Contributor

pmcnr-hx commented Apr 6, 2018

I agree with being consistent, and I also prefer the trailing backslash as a best practice. We will get round to addressing this at some point, but if you're willing to submit a PR to fix it we'll be very happy to review and merge it.

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

No branches or pull requests

2 participants