Checked json data.

This commit is contained in:
2025-05-04 08:18:55 -04:00
parent ce3400e353
commit cb7526dd45
2 changed files with 59 additions and 24 deletions

View File

@@ -284,4 +284,25 @@ mod servers {
"do not allow post to existing documents"
);
}
#[tokio::test]
async fn post_with_missing_document() {
let app = create_app(MoreThanText::new()).await;
let response = app
.clone()
.oneshot(
Request::builder()
.method(Method::POST)
.uri("/api/something")
.body("{}".to_string())
.unwrap(),
)
.await
.unwrap();
assert_eq!(
response.status(),
StatusCode::BAD_REQUEST,
"do not allow post to existing documents"
);
}
}