I have seen HTTP methods written in all caps and in all lowercase letters. Is there any reason why you would want to write POST
rather than post
in the method attribute of a form element, for example?
Do some browsers handle capitalized POST
and GET
differently than lowercase post
and get
?
Use all uppercase when referring to the HTTP or HTTPS protocol itself. In general, omit https:// and https:// from URLs. If for some reason you need to include https:// or https:// as part of a URL, use all lowercase.
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.
The request method indicates the method to be performed on the resource identified by the given Request-URI. The method is case-sensitive and should always be mentioned in uppercase.
The HTML5 spec requires to use "get" or "post".
Short answer: use lowercase in method
attributes of <form>
tags because the standard only allows lowercase.
Long answer: It slightly depends on the HTML version:
HTML5: The standard clearly states that lowercase get
maps to the HTTP method GET and that lowercase post
maps to HTTP method POST [1]. These are the only values mentioned there, attribute values are case sensitive and an enumerated attribute allows only the values mentioned in the standard. The examples in the HTML5 standard also use lowercase. So, if you want to follow HTML5 standard, use lowercase. In practice, it is not a problem to use uppercase with HTML5 though, and I have seen more usage of uppercase recently. Still, I don't see any reason why this should be good practice, as the standard states it otherwise.
XHTML: Use lowercase. The DTD of xhtml-strict and xhtml-transitional only define lowercase get
and post
[2, 3]. Here its is even more important, as using uppercase will produce an invalid XHTML document that can trigger ugly browser errors in practice (depends on DTD, browser and http content-type).
HTML 4: In these days, it was common practice to use uppercase, but lowercase also worked well in practice. This is just my personal experience, I am not going to look up the HTML 4 standard as it seems irrelevant nowadays (and nobody ever followed it strictly anyways).
W3Schools also uses lowercase [4].
[1] https://www.w3.org/TR/html5/forms.html#attr-fs-method
[2] https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd line 695
[3] https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd line 888
[4] https://www.w3schools.com/tags/att_form_method.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With