Can HTTP PUT request have application/x-www-form-urlencoded as the Content-Type?

Paul Nibin picture Paul Nibin · Jun 10, 2011 · Viewed 18.5k times · Source

Is it valid to send form data in an HTTP PUT request? If you could point me to a spec then that would be great.

I have gone through the HTTP 1.1 spec. But I did not find whether PUT requests can have form data or not.

I am using Java for creating and accessing RESTful webservices. POST supports application/x-www-form-urlencoded as the Content-Type.

From the specification, I understand that POST is for creating a new resource (a subresource to the resource identified by the request URI) and PUT is for create or update a resource.

But my doubt is whether PUT method also can have form data in it? I trying to find out whether it is fine according to the spec. And I can't find anything about this in the HTTP 1.1 spec.

Answer

Darrel Miller picture Darrel Miller · Jun 10, 2011

Yes you can use application/x-www-form-urlencoded with PUT. The HTTP spec does not limit what methods can be used with what media types.

The currently in-progress Httpbis spec has a significantly expanded discussion of PUT http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-14#page-18