mirror of https://github.com/fafhrd91/actix-web
Formatting changes
This commit is contained in:
parent
6189caa521
commit
a0b04fc158
|
@ -207,7 +207,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_json_payload_error() {
|
fn test_json_payload_error() {
|
||||||
let resp = JsonPayloadError::Overflow{size: 0, limit: 0}.error_response();
|
let resp = JsonPayloadError::Overflow { size: 0, limit: 0 }.error_response();
|
||||||
assert_eq!(resp.status(), StatusCode::PAYLOAD_TOO_LARGE);
|
assert_eq!(resp.status(), StatusCode::PAYLOAD_TOO_LARGE);
|
||||||
let resp = JsonPayloadError::ContentType.error_response();
|
let resp = JsonPayloadError::ContentType.error_response();
|
||||||
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
||||||
|
|
|
@ -455,7 +455,9 @@ mod tests {
|
||||||
|
|
||||||
fn json_eq(err: JsonPayloadError, other: JsonPayloadError) -> bool {
|
fn json_eq(err: JsonPayloadError, other: JsonPayloadError) -> bool {
|
||||||
match err {
|
match err {
|
||||||
JsonPayloadError::Overflow { .. } => matches!(other, JsonPayloadError::Overflow { .. }),
|
JsonPayloadError::Overflow { .. } => {
|
||||||
|
matches!(other, JsonPayloadError::Overflow { .. })
|
||||||
|
}
|
||||||
JsonPayloadError::ContentType => matches!(other, JsonPayloadError::ContentType),
|
JsonPayloadError::ContentType => matches!(other, JsonPayloadError::ContentType),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
@ -599,7 +601,13 @@ mod tests {
|
||||||
let json = JsonBody::<MyObject>::new(&req, &mut pl, None)
|
let json = JsonBody::<MyObject>::new(&req, &mut pl, None)
|
||||||
.limit(100)
|
.limit(100)
|
||||||
.await;
|
.await;
|
||||||
assert!(json_eq(json.err().unwrap(), JsonPayloadError::Overflow { size: 10000, limit: 100 }));
|
assert!(json_eq(
|
||||||
|
json.err().unwrap(),
|
||||||
|
JsonPayloadError::Overflow {
|
||||||
|
size: 10000,
|
||||||
|
limit: 100
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
let (req, mut pl) = TestRequest::default()
|
let (req, mut pl) = TestRequest::default()
|
||||||
.insert_header((
|
.insert_header((
|
||||||
|
@ -696,6 +704,7 @@ mod tests {
|
||||||
assert!(s.is_err());
|
assert!(s.is_err());
|
||||||
|
|
||||||
let err_str = s.err().unwrap().to_string();
|
let err_str = s.err().unwrap().to_string();
|
||||||
assert!(err_str.contains("JSON payload (16 bytes) is larger than allowed (limit: 10 bytes)."));
|
assert!(err_str
|
||||||
|
.contains("JSON payload (16 bytes) is larger than allowed (limit: 10 bytes)."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue