HTTP method names: upper or lower case?

和自甴很熟 提交于 2019-12-23 08:54:36

问题


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 a 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 POV, it seems that practices and standards are somewhat out of touch on this matter.

Upper-case is correct- right?


回答1:


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://stackoverflow.com/questions/27423615/http-method-names-upper-or-lower-case

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!