aboutsummaryrefslogtreecommitdiff
path: root/src/api/api_server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r--src/api/api_server.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs
index 74142453..240ffca9 100644
--- a/src/api/api_server.rs
+++ b/src/api/api_server.rs
@@ -65,10 +65,15 @@ async fn handler(
}
Err(e) => {
let body: Body = Body::from(e.aws_xml(&garage.config.s3_api.s3_region, uri.path()));
- let http_error = Response::builder()
+ let mut http_error_builder = Response::builder()
.status(e.http_status_code())
- .header("Content-Type", "application/xml")
- .body(body)?;
+ .header("Content-Type", "application/xml");
+
+ if let Some(header_map) = http_error_builder.headers_mut() {
+ e.add_headers(header_map)
+ }
+
+ let http_error = http_error_builder.body(body)?;
if e.http_status_code().is_server_error() {
warn!("Response: error {}, {}", e.http_status_code(), e);