The raw_post_data attribute will contain the raw data regardless of the
method used in the HTTP request. So it works identically for PUT and
POST. Have a look at the implementation: there's nothing that restricts
it to a single method. It would even work for OPTION or other HTTP
verbs.
Regards,
Malcolm
No, because it would be almost always wrong to do so.
The point is that request.POST is designed for web-browser POST
submission, which means it's going to be data encoded as a form
submission (or a mime-multipart if it contains a file upload). Web
browsers are very restricted beasts. Normal web services encompass a
much broader range of domains and there's no concept of a "common"
format for uploads. You have to look at the content-type and act
appropriately. It could be an XML document (or some subtype), image
data, a word document... anything. The content is described in the HTTP
method. It would be incorrect to attempt to force any of those data
types into dictionaries and not particularly useful for Django to
special case one particular type that will, in practice, actually be
pretty uncommon (machine interacting web services tend to use more
structured formats for sending data than form-encoded, since they're
sending more complex data than simple forms).
If you're doing REST-based web service stuff -- as opposed to just
interacting with a web browser -- you should ignore request.POST as well
for the same reasons unless you have a very well-understood, restricted
domain that happens to always send form-encoded data.
Apologies for being unclear in my original post, although you seem to
have worked out my intention. I was trying to say that POST and PUT (and
OPTIONS and DELETE) are treated identically in that all the data is in
raw_post_data, not that there was an attribute for each method. The
latter isn't appropriate for general cases.
Regards,
Malcolm