fix: return content-type for HTTP errors

No "Content-Type" header has ever been returned, even though the
response body has always been hard-coded to a JSON string.

This commit returns a content type of "application/json" for all
JSON-encoded HTTP errors.
pull/24376/head
Dom Dwyer 2023-02-06 14:16:15 +01:00
parent 5b6b7cbf86
commit 4aa5826300
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
1 changed files with 1 additions and 0 deletions

View File

@ -127,6 +127,7 @@ impl HttpApiError {
pub fn response(&self) -> Response<Body> {
Response::builder()
.status(self.code.status_code())
.header("content-type", "application/json")
.body(self.body())
.unwrap()
}