[−][src]Function httptest::mappers::json_decoded
pub fn json_decoded<T, M>(inner: M) -> JsonDecoded<T, M> where
M: Mapper<T, Out = bool>,
json decode the input and pass the resulting value to the inner mapper. If the input cannot be decoded a false value is returned. The inner mapper is required to return a bool value.
This can be used with Fn mappers to allow for flexible matching of json content. The following example matches whenever the body of the request contains a json list of strings of length 3.
use httptest::mappers::*; request::body(json_decoded(|b: &Vec<String>| b.len() == 3));