POSTing to a URI with GET query params?

I stumbled upon some code the other day that was making use of query params specified in the URI while at the same time being an HTTP POST.

I was just wondering, is the interpretation of these fields vendor specific? Do the RFCs say anything specific about it? And if a parameter exists in both, which one wins out?

To illustrate better, the query looked something like this:

POST /posts/?user=bob HTTP/1.1

user=bill&title=Test&content=Testing+Content

Thanks


This is perfect legal. Many frameworks have support for it for example the Servlet API even specifies the priority (order) of the arguments as they appear in getParameters(String) which will provide the query parameter first. For example this is also legal, not the parameter names are the same.

POST /path?param1=value HTTP/1.1
Host: localhost

param1=value&param2=value

This is also valid according to the HTTP/1.1 RFC, a look at RFC 2616.

It should not be vendor specific, and most comprehensive frameworks will support it.


There is no trumping. The GET and POST values are passed as separate collections.


I do this occasionally. Usually i'll put the actual update fields in the post data, with query data used to format the response

链接地址: http://www.djcxy.com/p/17580.html

上一篇: 在Python中使用HTTP GET最快的方法是什么?

下一篇: 使用GET查询参数发布到URI?