From 0267333f026eb0c77225b79d0bc44f757e875014 Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Wed, 11 Aug 2021 08:22:55 +0000 Subject: [PATCH] test with default --- src/types/json.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/types/json.rs b/src/types/json.rs index 1bf4c841d..b61ac4b36 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -266,7 +266,7 @@ impl JsonConfig { self } - /// Allows requets without any `Content-Type` header to be parsed as Json. + /// Sets whether or not the request must have a `Content-Type` header to be parsed. pub fn require_content_type(mut self, require_content_type: bool) -> Self { self.require_content_type = require_content_type; self @@ -591,7 +591,7 @@ mod tests { #[actix_rt::test] async fn test_json_body() { let (req, mut pl) = TestRequest::default().to_http_parts(); - let json = JsonBody::::new(&req, &mut pl, None, false).await; + let json = JsonBody::::new(&req, &mut pl, None, true).await; assert!(json_eq(json.err().unwrap(), JsonPayloadError::ContentType)); let (req, mut pl) = TestRequest::default() @@ -600,7 +600,7 @@ mod tests { header::HeaderValue::from_static("application/text"), )) .to_http_parts(); - let json = JsonBody::::new(&req, &mut pl, None, false).await; + let json = JsonBody::::new(&req, &mut pl, None, true).await; assert!(json_eq(json.err().unwrap(), JsonPayloadError::ContentType)); let (req, mut pl) = TestRequest::default() @@ -614,7 +614,7 @@ mod tests { )) .to_http_parts(); - let json = JsonBody::::new(&req, &mut pl, None, false) + let json = JsonBody::::new(&req, &mut pl, None, true) .limit(100) .await; assert!(json_eq( @@ -633,7 +633,7 @@ mod tests { .set_payload(Bytes::from_static(&[0u8; 1000])) .to_http_parts(); - let json = JsonBody::::new(&req, &mut pl, None, false) + let json = JsonBody::::new(&req, &mut pl, None, true) .limit(100) .await; @@ -654,7 +654,7 @@ mod tests { .set_payload(Bytes::from_static(b"{\"name\": \"test\"}")) .to_http_parts(); - let json = JsonBody::::new(&req, &mut pl, None, false).await; + let json = JsonBody::::new(&req, &mut pl, None, true).await; assert_eq!( json.ok().unwrap(), MyObject {