Opened 12 years ago

Closed 12 years ago

#18215 closed New feature (duplicate)

Don't assume POST data is always application/x-www-form-urlencoded

Reported by: Steve Lacy Owned by: nobody
Component: HTTP handling Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It seems as though the code in HttpRequest that takes the raw POST data and turns it into request.POST (a QueryDict instance) always assumes that the incoming data is form encoded. In fact, the QueryDict class itself does the decoding, which seems a bit odd to me.

Many web application frameworks are using JSON (application/javascript or text/json, usually) encoded POST bodies, and other frameworks will use (gasp!) XML. Django should look at the request.metaCONTENT_TYPE of the incoming data, and use the right deterializers. Supported deserializers should be "form encoded" (the current), json (via simplejson) and likely XML .

REST frameworks like django-rest-framework and tastypie have better handling of POST/PUT data than Django itself, irrespective of the "RESTyness" of the whole thing.

Change History (1)

comment:1 by Ramiro Morales, 12 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #5611.

Note: See TracTickets for help on using tickets.
Back to Top