DEV Community

Khoa Pham
Khoa Pham

Posted on

Case sensitivity in HTTP

Original post https://github.com/onmyway133/blog/issues/115

Is URL case sensitive ?

According to HTML and URLs

URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

Is header case sensitive?

According to RFC 7230

Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.

Is method case sensitive?

Using URLSession, mostly we will get 200 with request.httpMethod = "GET" and 400 with request.httpMethod = "get". Generally speaking, you should use some popular wrappers Alamofire or Malibu as they are mature enough. Spend your precious time solving more important problems instead.

According to RFC 7231

The method token is case-sensitive because it might be used as a gateway to object-based systems with case-sensitive method names.

Top comments (0)