Ticket #366 (closed defect: worksforme)
[PATCH] WebOb should leave req.body as is after parsing POST body
| Reported by: | wangchun | Owned by: | ianb |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.1 |
| Component: | webob | Version: | svn-trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
For an empty Content-Type, req.body returns empty string (v0.9.6) or raises an error (trunk) after req.POST is called.
For Content-Type == application/x-www-form-urlencoded:
import webob from StringIO import StringIO body = 'HELLO, WORLD!' environ = { 'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': str(len(body)), 'wsgi.input': StringIO(body), } req = webob.Request(environ) print req.body print req.POST print req.body
macbook:~/tmp$ python test.py
HELLO, WORLD!
MultiDict([('HELLO, WORLD!', '')])
HELLO%2C+WORLD%21=
macbook:~$
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

