Skip to content

Commit a52eda4

Browse files
authored
Merge pull request #51 from mbits-imaging/no-content-fix
fix: don't return NoContent anymore
2 parents 57f67a8 + f7bffec commit a52eda4

3 files changed

Lines changed: 16 additions & 28 deletions

File tree

src/api/mwl/routes.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,15 @@ async fn mwl_handler(provider: ServiceProvider, request: MwlSearchRequest) -> im
3232

3333
match matches {
3434
Ok(matches) => {
35-
if matches.is_empty() {
36-
StatusCode::NO_CONTENT.into_response()
37-
} else {
38-
let json: Vec<DicomJson<InMemDicomObject>> =
39-
matches.into_iter().map(DicomJson::from).collect();
35+
let json: Vec<DicomJson<InMemDicomObject>> =
36+
matches.into_iter().map(DicomJson::from).collect();
4037

41-
axum::response::Response::builder()
42-
.status(StatusCode::OK)
43-
.header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
44-
.body(StreamBodyAs::json_array(futures::stream::iter(json)))
45-
.unwrap()
46-
.into_response()
47-
}
38+
axum::response::Response::builder()
39+
.status(StatusCode::OK)
40+
.header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
41+
.body(StreamBodyAs::json_array(futures::stream::iter(json)))
42+
.unwrap()
43+
.into_response()
4844
}
4945
Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(),
5046
}

src/api/qido/routes.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,15 @@ async fn qido_handler(provider: ServiceProvider, request: SearchRequest) -> impl
4141

4242
match matches {
4343
Ok(matches) => {
44-
if matches.is_empty() {
45-
StatusCode::NO_CONTENT.into_response()
46-
} else {
47-
let json: Vec<DicomJson<InMemDicomObject>> =
48-
matches.into_iter().map(DicomJson::from).collect();
44+
let json: Vec<DicomJson<InMemDicomObject>> =
45+
matches.into_iter().map(DicomJson::from).collect();
4946

50-
axum::response::Response::builder()
51-
.status(StatusCode::OK)
52-
.header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
53-
.body(StreamBodyAs::json_array(futures::stream::iter(json)))
54-
.unwrap()
55-
.into_response()
56-
}
47+
axum::response::Response::builder()
48+
.status(StatusCode::OK)
49+
.header(header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
50+
.body(StreamBodyAs::json_array(futures::stream::iter(json)))
51+
.unwrap()
52+
.into_response()
5753
}
5854
Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(),
5955
}

src/api/wado/routes.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ async fn metadata_resource(
151151

152152
match matches {
153153
Ok(matches) => {
154-
if matches.is_empty() {
155-
return StatusCode::NO_CONTENT.into_response();
156-
}
157-
158154
let json: Vec<DicomJson<InMemDicomObject>> = matches
159155
.into_iter()
160156
// FIXME: Cloning the data so we can mutate it

0 commit comments

Comments
 (0)