Add support for generators as a body of the request.

The code assumes that we have only file like objects or strings as body of the request.
With this change also generators can be set as a body of the request.