[][src]Trait reqwest_pretty_json::PrettyJson

pub trait PrettyJson<T: ?Sized>: Sized where
    T: Serialize
{ fn pretty_json(self, json: &T) -> Self; }

A trait to set HTTP request body to a "prettified" JSON-formatted representation of the data.

Required methods

fn pretty_json(self, json: &T) -> Self

Send a "pretty" JSON body.

Set the HTTP request body to the "pretty" (human-friendly) JSON serialization of the passed value, and also set the Content-Type: application/json header.

use reqwest_pretty_json::PrettyJson;

let mut map = HashMap::new();
map.insert("lang", "rust");

let client = reqwest::Client::new();
let res = client.post("http://httpbin.org")
    .pretty_json(&map)
    .send()?;

Errors

Same as reqwest::RequestBuilder::json. See reqwest for more details.

Loading content...

Implementations on Foreign Types

impl<T: ?Sized> PrettyJson<T> for RequestBuilder where
    T: Serialize
[src]

impl<T: ?Sized> PrettyJson<T> for AsyncRequestBuilder where
    T: Serialize
[src]

Loading content...

Implementors

Loading content...