Struct curs::Request [] [src]

pub struct Request<'a> {
    // some fields omitted
}

The main entry point. Craft your request and send it.

Methods

impl<'a> Request<'a>

fn new(method: Method, url: &'a str) -> Request<'a>

You'll always need a method and the url to start.

fn params<P>(&mut self, additional: P) -> &mut Request<'a> where P: IntoIterator<Item=Param<'a>>

Add params. This extends the existing params vector.

fn json<S: Serialize>(&mut self, thing: S) -> &mut Request<'a>

Use a serde::se::Serialize as JSON raw body. Adds the content-type: application/json header. This will override anything you've sent in in "params". If you need a json raw body and your params in the same request, either you're just being silly or need to fall back to curs::hyper::client.

fn override_body(&mut self, body: String) -> &mut Request<'a>

Sets a raw body, overriding anything that was previously set in params. Make sure to set the content-type header to match whatever you're adding here.

fn files<F>(&mut self, additional: F) -> &mut Request<'a> where F: IntoIterator<Item=FileUpload<'a>>

Add files to upload. This extends the existing files vector.

fn header<H>(&mut self, additional: H) -> &mut Request<'a> where H: Header + HeaderFormat

Add a single header.

fn send(&self) -> CursResult<Response>

Send your request and see what happens.

Trait Implementations

Derived Implementations

impl<'a> Clone for Request<'a>

fn clone(&self) -> Request<'a>

1.0.0fn clone_from(&mut self, source: &Self)