dexador
dexador copied to clipboard
Allow stream :content
This allows :content
to be a stream.
If :content
is a stream and :content-length
is a specified header,
set :content-length
and copy that many bytes.
If :content
is a stream and :content-length
is not specified,
set :transfer-encoding
to chunked
, and copy the entire stream.
The :content-type
in both cases is defaulted to application/octet-stream
The only worrying thing is that since reading from a stream can only be done once, any attempts at auto-reconnect will have unexpected behavior, as the stream will possibly be emptied.
One improvement would be to use a non-chunked content if the user supplies the Content-Length header, and then only copy Content-Length bytes.
@tmccombs Agreed, that would be better. I've have added a commit to do so.