带请求正文的HTTP GET

时光怂恿深爱的人放手 提交于 2020-08-17 17:33:49

问题:

I'm developing a new RESTful webservice for our application. 我正在为我们的应用程序开发新的RESTful Web服务。

When doing a GET on certain entities, clients can request the contents of the entity. 在某些实体上执行GET时,客户端可以请求实体的内容。 If they want to add some parameters (for example sorting a list) they can add these parameters in the query string. 如果他们想添加一些参数(例如,对列表进行排序),则可以在查询字符串中添加这些参数。

Alternatively I want people to be able to specify these parameters in the request body. 另外,我希望人们能够在请求正文中指定这些参数。 HTTP/1.1 does not seem to explicitly forbid this. HTTP / 1.1似乎没有明确禁止这样做。 This will allow them to specify more information, might make it easier to specify complex XML requests. 这将使他们能够指定更多信息,可能使指定复杂的XML请求更加容易。

My questions: 我的问题:

  • Is this a good idea altogether? 这是个好主意吗?
  • Will HTTP clients have issues with using request bodies within a GET request? HTTP客户端在GET请求中使用请求主体时会遇到问题吗?

http://tools.ietf.org/html/rfc2616 http://tools.ietf.org/html/rfc2616


解决方案:

参考一: https://stackoom.com/question/46RB/带请求正文的HTTP-GET
参考二: https://oldbug.net/q/46RB/HTTP-GET-with-request-body
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!