Files
axum-valid/tests/utils.rs
2023-08-01 22:11:44 +08:00

10 lines
360 B
Rust

/// Check if the response is a json response
#[cfg(feature = "into_json")]
pub async fn check_json(response: reqwest::Response) {
assert_eq!(
response.headers()[axum::http::header::CONTENT_TYPE],
axum::http::HeaderValue::from_static(mime::APPLICATION_JSON.as_ref())
);
assert!(response.json::<serde_json::Value>().await.is_ok());
}