Skip to content

Commit 0587af7

Browse files
committed
properly add vary header for alternative content-types
1 parent 5ee3f60 commit 0587af7

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

backend/src/response.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,13 @@ impl ApiResponse {
9696
Self {
9797
body,
9898
status: axum::http::StatusCode::OK,
99-
headers: axum::http::HeaderMap::from_iter([(
100-
axum::http::header::CONTENT_TYPE,
101-
content_type,
102-
)]),
99+
headers: axum::http::HeaderMap::from_iter([
100+
(axum::http::header::CONTENT_TYPE, content_type),
101+
(
102+
axum::http::header::VARY,
103+
axum::http::HeaderValue::from_static("Accept"),
104+
),
105+
]),
103106
}
104107
}
105108

0 commit comments

Comments
 (0)