1

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

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.