fix: incorrect json response content type
This commit is contained in:
@@ -15,6 +15,8 @@ use serde_json::json;
|
||||
use std::net::SocketAddr;
|
||||
use validator::Validate;
|
||||
|
||||
mod utils;
|
||||
|
||||
mod route {
|
||||
pub const PATH: &str = "/path/:v0/:v1";
|
||||
pub const QUERY: &str = "/query";
|
||||
@@ -78,10 +80,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
assert_eq!(invalid_path_response.status(), VALIDATION_ERROR_STATUS);
|
||||
#[cfg(feature = "into_json")]
|
||||
assert!(invalid_path_response
|
||||
.json::<serde_json::Value>()
|
||||
.await
|
||||
.is_ok());
|
||||
utils::check_json(invalid_path_response).await;
|
||||
println!("Valid<Path<...>> works.");
|
||||
|
||||
// Valid<Query<...>>
|
||||
@@ -107,10 +106,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
assert_eq!(invalid_query_response.status(), VALIDATION_ERROR_STATUS);
|
||||
#[cfg(feature = "into_json")]
|
||||
assert!(invalid_query_response
|
||||
.json::<serde_json::Value>()
|
||||
.await
|
||||
.is_ok());
|
||||
utils::check_json(invalid_query_response).await;
|
||||
println!("Valid<Query<...>> works.");
|
||||
|
||||
// Valid<Form<...>>
|
||||
@@ -139,10 +135,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
assert_eq!(invalid_form_response.status(), VALIDATION_ERROR_STATUS);
|
||||
#[cfg(feature = "into_json")]
|
||||
assert!(invalid_form_response
|
||||
.json::<serde_json::Value>()
|
||||
.await
|
||||
.is_ok());
|
||||
utils::check_json(invalid_form_response).await;
|
||||
println!("Valid<Form<...>> works.");
|
||||
|
||||
// Valid<Json<...>>
|
||||
@@ -171,10 +164,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
assert_eq!(invalid_json_response.status(), VALIDATION_ERROR_STATUS);
|
||||
#[cfg(feature = "into_json")]
|
||||
assert!(invalid_json_response
|
||||
.json::<serde_json::Value>()
|
||||
.await
|
||||
.is_ok());
|
||||
utils::check_json(invalid_json_response).await;
|
||||
println!("Valid<Json<...>> works.");
|
||||
|
||||
drop(server_guard);
|
||||
|
||||
Reference in New Issue
Block a user