From f7bffec1a142bae073c58771bc88a97424de275c Mon Sep 17 00:00:00 2001 From: Stephan Vedder Date: Thu, 19 Feb 2026 13:35:20 +0100 Subject: [PATCH] fix: don't return NoContent anymore --- src/api/mwl/routes.rs | 20 ++++++++------------ src/api/qido/routes.rs | 20 ++++++++------------ src/api/wado/routes.rs | 4 ---- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/src/api/mwl/routes.rs b/src/api/mwl/routes.rs index 7d82c54..b59c455 100644 --- a/src/api/mwl/routes.rs +++ b/src/api/mwl/routes.rs @@ -32,19 +32,15 @@ async fn mwl_handler(provider: ServiceProvider, request: MwlSearchRequest) -> im match matches { Ok(matches) => { - if matches.is_empty() { - StatusCode::NO_CONTENT.into_response() - } else { - let json: Vec> = - matches.into_iter().map(DicomJson::from).collect(); + let json: Vec> = + matches.into_iter().map(DicomJson::from).collect(); - axum::response::Response::builder() - .status(StatusCode::OK) - .header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref()) - .body(StreamBodyAs::json_array(futures::stream::iter(json))) - .unwrap() - .into_response() - } + axum::response::Response::builder() + .status(StatusCode::OK) + .header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref()) + .body(StreamBodyAs::json_array(futures::stream::iter(json))) + .unwrap() + .into_response() } Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(), } diff --git a/src/api/qido/routes.rs b/src/api/qido/routes.rs index 9c0cb3c..34684fd 100644 --- a/src/api/qido/routes.rs +++ b/src/api/qido/routes.rs @@ -41,19 +41,15 @@ async fn qido_handler(provider: ServiceProvider, request: SearchRequest) -> impl match matches { Ok(matches) => { - if matches.is_empty() { - StatusCode::NO_CONTENT.into_response() - } else { - let json: Vec> = - matches.into_iter().map(DicomJson::from).collect(); + let json: Vec> = + matches.into_iter().map(DicomJson::from).collect(); - axum::response::Response::builder() - .status(StatusCode::OK) - .header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref()) - .body(StreamBodyAs::json_array(futures::stream::iter(json))) - .unwrap() - .into_response() - } + axum::response::Response::builder() + .status(StatusCode::OK) + .header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref()) + .body(StreamBodyAs::json_array(futures::stream::iter(json))) + .unwrap() + .into_response() } Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(), } diff --git a/src/api/wado/routes.rs b/src/api/wado/routes.rs index a4f4994..553d0c0 100644 --- a/src/api/wado/routes.rs +++ b/src/api/wado/routes.rs @@ -151,10 +151,6 @@ async fn metadata_resource( match matches { Ok(matches) => { - if matches.is_empty() { - return StatusCode::NO_CONTENT.into_response(); - } - let json: Vec> = matches .into_iter() // FIXME: Cloning the data so we can mutate it