Struct multipart::client::SizedRequest [] [src]

pub struct SizedRequest<R> { /* fields omitted */ }

A wrapper around a request object that measures the request body and sets the Content-Length header to its size in bytes.

Sized requests are more human-readable and use less bandwidth (as chunking adds visual noise and overhead), but they must be able to load their entirety, including the contents of all files and streams, into memory so the request body can be measured.

You should really only use sized requests if you intend to inspect the data manually on the server side, as it will produce a more human-readable request body. Also, of course, if the server doesn't support chunked requests or otherwise rejects them.

Trait Implementations

impl<R> Write for SizedRequest<R>
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl<R: HttpRequest> HttpRequest for SizedRequest<R> where R::Stream::Error: From<R::Error>
[src]

The HTTP stream type that can be opend by this request, to which the multipart data will be written. Read more

The error type for this request. Must be compatible with io::Error as well as Self::HttpStream::Error Read more

SizedRequest ignores _content_len because it sets its own later.

Open the request stream and return it or any error otherwise.

impl<R: HttpRequest> HttpStream for SizedRequest<R> where R::Stream::Error: From<R::Error>
[src]

The request type that opened this stream.

The response type that will be returned after the request is completed.

The error type for this stream. Must be compatible with io::Error as well as Self::Request::Error. Read more

Finalize and close the stream and return the response object, or any error otherwise.