Afaik, with & without trailing slash are two distinct URLs so you're potentially creating two cache entries for every resource by doing this.
Why not just return a 404 and make this rule explicit in your API? Another thing, if your clients are following links this effectively becomes a non issue.
Cheers,
M
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
On the Web API side, I usually just handle both. Most good URL routers will do this. Then you can accommodate everyone's preference. I'd advise against doing HTTP tricks (redirects) and just handle it server-side with no additional round-trip.
--
A 404 with a text plain body that says 'try removing the trailing slash in the URL' is fairly self explanatory. Thinking of clients is important but not sure this is a big deal for them either way so it should be ok to pick the better option for the server.
> service breaks because it treats service.com/123 different than
> service.com/123/.
I don't get it. These are _clearly_ two different URIs and thus two
different resources so should not respond in the same way.
That people like to think of the slash as a "meaningless" separator
is bunk. It's simply a character in a string.