You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
when i query the /loki/api/v1/query endpoint, the response body is correct, but the content-type header says text/plain; charset=utf-8 . it should be application/json.
To Reproduce
Steps to reproduce the behavior:
Started Loki using the docker image: docker run -p 3100:3100 grafana/loki:2.4.1
run any query using the /loki/api/v1/query endpoint
the response has this http header: Content-Type: text/plain; charset=utf-8
Expected behavior
the response should have this http header: Content-Type: application/json; charset=UTF-8
Environment:
nothing special, running docker on mac-os
NOTE: it returns the correct Content-Type: application/json; charset=UTF-8 header when running with the version 2.3.0 docker image.
The text was updated successfully, but these errors were encountered:
Because the internal query request handlers did not set the response
content type explicitly to `application/json`, and the external request
handler takes the response content type from the internal response to
set it for the resulting HTTP response, that response was also
incorrectly returning `Content-Type: text/plain`.
Setting the content type in the internal response correctly results in
the expected `Content-Type` header `application/json; charset=UTF-8`.
Fixes#4791
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
* Set correct `Content-Type` header in query response
Because the internal query request handlers did not set the response
content type explicitly to `application/json`, and the external request
handler takes the response content type from the internal response to
set it for the resulting HTTP response, that response was also
incorrectly returning `Content-Type: text/plain`.
Setting the content type in the internal response correctly results in
the expected `Content-Type` header `application/json; charset=UTF-8`.
Fixes#4791
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
* fixup! Set correct `Content-Type` header in query response
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
* fixup! fixup! Set correct `Content-Type` header in query response
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Describe the bug
when i query the
/loki/api/v1/query
endpoint, the response body is correct, but the content-type header saystext/plain; charset=utf-8
. it should beapplication/json
.To Reproduce
Steps to reproduce the behavior:
docker run -p 3100:3100 grafana/loki:2.4.1
/loki/api/v1/query
endpointContent-Type: text/plain; charset=utf-8
Expected behavior
the response should have this http header:
Content-Type: application/json; charset=UTF-8
Environment:
NOTE: it returns the correct
Content-Type: application/json; charset=UTF-8
header when running with the version2.3.0
docker image.The text was updated successfully, but these errors were encountered: