test(gateway): /publish first-line invalid JSON returns 400 INVALID_INPUT (COV-12 review-002)
This commit is contained in:
@@ -2288,6 +2288,20 @@ mod tests {
|
||||
assert_eq!(body.get("code"), Some(&json!("INVALID_INPUT")));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn publish_first_line_invalid_json_returns_400() {
|
||||
let router = build_router(publish_registry(), unused_provider());
|
||||
let req = raw_request("POST", "/publish", b"not-json-at-all\n".to_vec());
|
||||
let (status, body) = send(router, req).await;
|
||||
assert_eq!(status, StatusCode::BAD_REQUEST);
|
||||
assert_eq!(body.get("code"), Some(&json!("INVALID_INPUT")));
|
||||
let message = body.get("message").and_then(Value::as_str).unwrap_or("");
|
||||
assert!(
|
||||
message.contains("not valid JSON"),
|
||||
"the 400 must name the JSON parse failure: {message}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn publish_first_line_missing_chunk_returns_400_invalid_input() {
|
||||
let router = build_router(publish_registry(), unused_provider());
|
||||
|
||||
Reference in New Issue
Block a user