dexador icon indicating copy to clipboard operation
dexador copied to clipboard

Allow stream :content

Open wemeetagain opened this issue 9 years ago • 2 comments

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.

wemeetagain avatar Nov 01 '15 06:11 wemeetagain

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 avatar Nov 01 '15 16:11 tmccombs

@tmccombs Agreed, that would be better. I've have added a commit to do so.

wemeetagain avatar Nov 01 '15 20:11 wemeetagain