[][src]Trait multipart::client::HttpRequest

pub trait HttpRequest {
    type Stream: HttpStream;
    type Error: From<Error> + Into<<Self::Stream as HttpStream>::Error>;
    pub fn apply_headers(
        &mut self,
        boundary: &str,
        content_len: Option<u64>
    ) -> bool;
pub fn open_stream(self) -> Result<Self::Stream, Self::Error>; }

A trait describing an HTTP request that can be used to send multipart data.

Associated Types

type Stream: HttpStream[src]

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

type Error: From<Error> + Into<<Self::Stream as HttpStream>::Error>[src]

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

Loading content...

Required methods

pub fn apply_headers(
    &mut self,
    boundary: &str,
    content_len: Option<u64>
) -> bool
[src]

Set the Content-Type header to multipart/form-data and supply the boundary value. If content_len is given, set the Content-Length header to its value.

Return true if any and all sanity checks passed and the stream is ready to be opened, or false otherwise.

pub fn open_stream(self) -> Result<Self::Stream, Self::Error>[src]

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

Loading content...

Implementations on Foreign Types

impl HttpRequest for Request<Fresh>[src]

type Stream = Request<Streaming>

type Error = HyperError

pub fn apply_headers(
    &mut self,
    boundary: &str,
    content_len: Option<u64>
) -> bool
[src]

Panics

If self.method() != Method::Post.

impl HttpRequest for ()[src]

type Stream = Sink

type Error = Error

Loading content...

Implementors

impl HttpRequest for ClientRequest[src]

type Stream = HttpBuffer

type Error = Error

pub fn open_stream(self) -> Result<HttpBuffer, Error>[src]

Panics

If apply_headers() was not called.

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

type Stream = Self

type Error = R::Error

pub fn apply_headers(
    &mut self,
    boundary: &str,
    _content_len: Option<u64>
) -> bool
[src]

SizedRequest ignores _content_len because it sets its own later.

Loading content...