add an error section to RequestBuilder.json

This commit is contained in:
Corentin Henry
2017-05-31 17:50:20 -07:00
parent 20f2896ab4
commit 0f0bf882d9

View File

@@ -617,6 +617,11 @@ impl RequestBuilder {
/// # Ok(())
/// # }
/// ```
///
/// # Errors
///
/// Serialization can fail if `T`'s implementation of `Serialize` decides to
/// fail, or if `T` contains a map with non-string keys.
pub fn json<T: Serialize>(mut self, json: &T) -> ::Result<RequestBuilder> {
let body = serde_json::to_vec(json).map_err(::error::from)?;
self.headers.set(ContentType::json());