HTTP方法名称:大写还是小写? [英] HTTP method names: upper or lower case?

查看:367
本文介绍了HTTP方法名称:大写还是小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个自我回答的问题,但我希望你们中的一个可以将我指向任何已声明或可以推断出该资源的资源,以便在以下情况中声明HTTP方法名称时使用大写还是小写字母: HTTP或REST请求.我看到的大多数示例都将GET,PUT,POST,DELETE,PATCH等用大写字母表示,而我假设HTTP方法字段名称不区分大小写-例如,"get"同等有效作为"GET".传统上我一直使用大写字母,但是我想确定一下.

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.

W3C 明确声明该方法是区分大小写并使用大写字母,但是在我的工作中,我经常遇到使用小写字母的HTTP方法字段值,我认为这是不正确的,因此从我的POV看来,实践和标准在此方面有些脱节问题.

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.

大写是正确的吗?

推荐答案

方法名称区分大小写,并且所有注册的方法均大写.

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

(W3C在这里实际上并不重要;重要的是RFC 7230和7231).

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

这篇关于HTTP方法名称:大写还是小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆