Crate hyper_multipart_rfc7578[][src]

This crate contains an implementation of the multipart/form-data media type described in RFC 7578 for hyper.

Currently, only the client-side is implemented.

Usage

[dependencies]
hyper-multipart-rfc7578 = "0.1.0-alpha3"

Because the name of this library is really wordy, I recommend shortening it:

extern crate hyper_multipart_rfc7578 as hyper_multipart;

Using this requires a hyper client compatible with the multipart::Body data structure (see the documentation for more detailed examples):


use hyper::{Client, Request, rt::{self, Future}};
use hyper_multipart_rfc7578::client::{self, multipart};

let client = Client::new();
let mut req_builder = Request::get("http://localhost/upload");
let mut form = multipart::Form::default();

form.add_text("test", "Hello World");
let req = form.set_body(&mut req_builder).unwrap();

rt::run(
    client
        .request(req)
        .map(|_| println!("done..."))
        .map_err(|_| println!("an error occurred")),
);

Modules

client