[−][src]Trait reqwest_pretty_json::PrettyJson
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.
Implementations on Foreign Types
impl<T: ?Sized> PrettyJson<T> for RequestBuilder where
T: Serialize,
[src]
T: Serialize,
fn pretty_json(self, json: &T) -> Self
[src]
impl<T: ?Sized> PrettyJson<T> for AsyncRequestBuilder where
T: Serialize,
[src]
T: Serialize,