Fix query params giving plain text error (#509)

This commit is contained in:
triphora 2023-01-05 17:14:39 -05:00 committed by GitHub
parent 7d195367a8
commit 1611049623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,6 +271,12 @@ async fn main() -> std::io::Result<()> {
dotenvy::var("RATE_LIMIT_IGNORE_KEY").ok(),
),
)
.app_data(web::QueryConfig::default().error_handler(|err, _req| {
routes::ApiError::Validation(err.to_string()).into()
}))
.app_data(web::JsonConfig::default().error_handler(|err, _req| {
routes::ApiError::Validation(err.to_string()).into()
}))
.app_data(web::Data::new(pool.clone()))
.app_data(web::Data::new(file_host.clone()))
.app_data(web::Data::new(search_config.clone()))