feat: allow setting http response header in fullstack

This commit is contained in:
Jonathan Kelley committed 2025-10-15 01:20:16 -07:00
1 parent 0aa7351473
commit 20fa29ac6e
3 files changed
+38 -5

No files matched your search

+9 -1
View File
@@ -304,15 +304,23 @@ impl RenderHandleState {
.await;
match response {
Ok((status, freshness, rx)) => {
Ok((status, headers, freshness, rx)) => {
let mut response = Response::builder()
.status(status.status)
.header(CONTENT_TYPE, "text/html; charset=utf-8")
.body(Body::from_stream(rx))
.unwrap();
// Write our freshness header
freshness.write(response.headers_mut());
// write the other headers set by the user
for (key, value) in headers.into_iter() {
if let Some(key) = key {
response.headers_mut().insert(key, value);
}
}
response
}