refactor: Upload extractor, 429 refusal test, stricter contract test

This commit is contained in:
2026-10-25 21:59:31 +01:00
parent c8d9138349
commit 2ac1d4e0cf
10 changed files with 139 additions and 52 deletions

View File

@@ -529,3 +529,28 @@ async fn a_json_body_of_the_wrong_shape_is_refused_as_unprocessable() {
assert_eq!(resp.status(), StatusCode::UNPROCESSABLE_ENTITY);
assert_eq!(refusal_body(resp).await["code"], "INVALID_INPUT");
}
#[tokio::test]
async fn a_non_multipart_upload_is_refused_with_invalid_input_code() {
let app = Router::new()
.route(
"/api/v1/webhooks/plex",
axum::routing::post(crate::api::webhook::post_plex_webhook),
)
.with_state(test_app_state());
let resp = app
.oneshot(
Request::builder()
.method("POST")
.uri("/api/v1/webhooks/plex?token=t")
.header("content-type", "text/plain")
.body(Body::from("hello"))
.unwrap(),
)
.await
.unwrap();
assert!(resp.status().is_client_error());
assert_eq!(refusal_body(resp).await["code"], "INVALID_INPUT");
}