pub fn to_json<T: 'static + DeserializeOwned>(&self) -> Result<T> {
        use hyper::header::ContentType;
        if let Some(&ContentType(ref ty)) = self.headers.get::<ContentType>() {
            if ty.type_() != "application" || ty.subtype() != "json" {
                let err = Error::bad_request("Content should be of type `application/json`.");
                return Err(err)
            }
        }
        ::serde_json::from_slice::<T>(&self.body)
            .map_err(|e| Error::internal("Unable to deserialize body as JSON.").with_cause(e))
    }
/// Deserialize the body into a structure, or a generic container, only if
/// the `Content-Type` is of type `application/json`.
Deserialize the body into a structure, or a generic container, only if
the `Content-Type` is of type `application/json`.
Deserialize the body into a structure or a generic container only if the ` Content - Type ` is of type ` application / json ` .
pub fn to_json<T: 'static + DeserializeOwned>(&self) -> Result<T> {
        use hyper::header::ContentType;
        if let Some(&ContentType(ref ty)) = self.headers.get::<ContentType>() {
            if ty.type_() != "application" || ty.subtype() != "json" {
                let err = Error::bad_request("Content should be of type `application/json`.");
                return Err(err)
            }
        }
        ::serde_json::from_slice::<T>(&self.body)
            .map_err(|e| Error::internal("Unable to deserialize body as JSON.").with_cause(e))
    }
pub fn to_json < T : ' static + DeserializeOwned > ( & self ) -> Result < T > { use hyper :: header :: ContentType ; if let Some ( & ContentType ( ref ty ) ) = self . headers . get :: < ContentType > ( ) { if ty . type_ ( ) != " " || ty . subtype ( ) != " " { let err = Error :: bad_request ( " " ) ; return Err ( err ) } } :: serde_json :: from_slice :: < T > ( & self . body ) . map_err ( | e | Error :: internal ( " " ) . with_cause ( e ) ) }
Deserialize the body into a structure, or a generic container, only if
the `Content-Type` is of type `application/json`.
Deserialize the body into a structure or a generic container only if the ` Content - Type ` is of type ` application / json ` .
&self
&self