Formatting changes

This commit is contained in:
peter-formlogic 2021-04-14 17:33:03 +09:30
parent 6189caa521
commit a0b04fc158
No known key found for this signature in database
GPG Key ID: CE3C608698F6E66B
2 changed files with 13 additions and 4 deletions

View File

@ -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)."));
} }
} }