Mint.HTTP1.stream_request_body
stream_request_body
, go back to Mint.HTTP1 module for more information.
Specs
stream_request_body( t(), Mint.Types.request_ref(), iodata() | :eof | {:eof, trailing_headers :: Mint.Types.headers()} ) :: {:ok, t()} | {:error, t(), Mint.Types.error()}
See Mint.HTTP.stream_request_body/3
.
In HTTP/1, sending an empty chunk is a no-op.
Transfer encoding and content length
When streaming the request body, Mint cannot send a precalculated content-length
request header because it doesn't know the body that you'll stream. However, Mint
will transparently handle the presence of a content-length
header using this logic:
if you specifically set a
content-length
header, then transfer encoding and making sure the content length is correct for what you'll stream is up to you.if you specifically set the transfer encoding (
transfer-encoding
header) tochunked
, then it's up to you to properly encode chunks.if you don't set the transfer encoding to
chunked
and don't provide acontent-length
header, Mint will do implicitchunked
transfer encoding (setting thetransfer-encoding
header appropriately) and will take care of properly encoding the chunks.