mardi 21 février 2017

For REST APIs, are URLs meant to be case insensitive?

I was reading the W3C URL Specification and I noticed that there is nothing explicitly mentioned about this.

Experiments

So what I tried in curl was

www.google.com

and then

www.GOOGLE.com

and these returned the same document. So I thought maybe google owns all variations on its domain name, so I tried other sites and I get mixed results.

So I mixed the case on the URL Specification and it seems to allow mixed case.

Applying this to REST API Design

So when applying this to REST API design, sometimes we use the notion of an identifier to return a specific resource from the server. E.g.

In https://localhost:8080/contacts/MYSELF, MYSELF would be the typical identifier

Based on those previous experiences, the case of MYSELF should not matter. But what if I wanted strict validation on the identifier?

Sure, you can go against the spec and do this in the application; but what is the appropriate thing to do in this case?

So back to the subject. Are URLs meant to be case insensitive?




Aucun commentaire:

Enregistrer un commentaire