Fixed issues with Content-Type headers. If one is present it should be modified without adding a new one (which would be disregarded by the browser)
This commit is contained in:
@@ -59,7 +59,14 @@ where
|
||||
let val = HeaderValue::from_str(self.mime_type.as_str()).expect("Invalid MimeType");
|
||||
Box::pin(async move {
|
||||
let mut res = fut.await?;
|
||||
match res.headers_mut().get_mut(CONTENT_TYPE) {
|
||||
Some(content_type) => {
|
||||
*content_type = val;
|
||||
}
|
||||
None => {
|
||||
res.headers_mut().append(CONTENT_TYPE, val);
|
||||
}
|
||||
}
|
||||
Ok(res)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user