kennethreitz/requests — Issue #448: request body expects unicode instead of bytes
Author: mstan
Created: 2012-02-21 17:23:21+00:00
State: open

The documentation states that :
data – (optional) Dictionary or bytes to send in the body of the Request

However the code in models.py (line 429 in 0.10.4) uses : "isinstance(self.data, str)" to check for non-form data, and "str" was imported from requests.compat as unicode (str for python 3, unicode for python 2)

This means that:
1. implementation does not conform to documentation
2. unexpected behaviour with python 2.x, for example calling requests.post(url, data="mydata") will NOT result in a non-encoded data, because "mydata" will be a simple "str", not a request.compat.str

I was expecting both unicode and bytes to be considered non-form data parameters