I was confused on this years ago. The problem is in naming...

`curl` is concerned with the HTTP method `POST`.  Let's call that `HTTP 
POST`.  If you look at the `curl` documents for the difference on the 
various `--data-XXXX` options.  Those options will `HTTP POST` data in 
different formats and encodings.

WebOb's `request.POST` isn't the same as `HTTP POST` though; it's a 
convenience method that pre-processing structured form data submissions via 
`HTTP POST` 
(see 
https://docs.pylonsproject.org/projects/webob/en/stable/api/request.html#webob.request.BaseRequest.POST)

If you look at the source of webob's POST 
https://github.com/Pylons/webob/blob/master/src/webob/request.py#L749-L797 
you'll see that it's trying to parse the raw data such as 
`self.body_file_raw` and `self.body_file` into form values.

Since your `HTTP POST` data isn't a form, you want to avoid all that 
processing and just operate on the raw data.  IIRC `body_file_raw` is 
better for uploads, because it avoids reading/consuming the body (which may 
be a stream instead of a static file).  I default to `body_file_raw` out of 
habit.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/3d8848d6-87cc-4fab-9e46-eede7457e878%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to