Checked json data.
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user