Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP method names: upper or lower case?

This may be a self-answering question, but I'm hoping one of you could point me to any resource where it is declared, or can be inferred, whether to use upper or lower case letters when declaring an HTTP method name in HTTP or REST requests. The majority of examples I see put GET, PUT, POST, DELETE, PATCH etc in capital letters, whereas I go on the assumption that HTTP method field names are case insensitive - that is, for example, that "get" is equally as valid as "GET". Traditionally, I have always used capital letters, but I would just like to be sure.

The W3C explicitly declares that the method is case-sensitive and uses upper case, but in my travails, I've often encountered HTTP method field values using lower case, which I assume are incorrect, so from my point of view, it seems that practices and standards are somewhat out of touch on this matter.

Upper case is correct - right?

like image 879
VLostBoy Avatar asked Dec 11 '14 13:12

VLostBoy


People also ask

Should methods be with uppercase?

Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters.

Are HTTP methods case-sensitive?

The method is case-sensitive. The list of methods allowed by a resource can be specified in an Allow header field (section 14.7).

Should methods be lowercase?

Method names should always begin with a lower case character, and should not contain underscores.

Does upper or lower case matter in URL?

Google's John Mueller clarifies that URLs are case sensitive, so it matters whether the characters are uppercase or lowercase. Variations in cases can make one URL different from another, similar to how a URL with a trailing slash is different from a URL without the slash.


1 Answers

Method names are case-sensitive, and all registered methods are all upper-case.

(and the W3C really doesn't matter here; what's relevant are RFCs 7230 and 7231).

https://www.rfc-editor.org/rfc/rfc7231#section-4.1

like image 121
Julian Reschke Avatar answered Sep 19 '22 09:09

Julian Reschke