mirror of https://github.com/grafana/loki
Loki: Change how push API checks for contentType (#4443)
* Change how push API checks for contentType - Currently, the ContentType is expected to be exactly "application/json". That's a problem because although a "application/json; charset=utf-8" is considered a valid JSON content type, it will be seen as an error. * Use mime.ParseMediaType to parse contentType. - mime.ParseMediaType is more reliable than strings.Contains because if a wrong contentType (such as "application/jsonnn") is given, we still accept it - mime.ParseMediaType has support for contentType parameters. This way, valid contentTypes such as "application/json; charset=utf-8" will not be rejected * Add changelog entry. * Change body in test to avoid lint issues. - Without this change, the lint fails because gzipString would be called with always the same input. Full error: ``` `gzipString` - `source` always receives ``{"streams": [{ "stream": { "foo": "bar2" }, "values": [ [ "1570818238000000000", "fizzbuzz" ] ] }]}` ("{\"streams\": [{ \"stream\": { \"foo\": \"bar2\" }, \"values\": [ [ ...) ` (unparam) ```pull/4338/head
parent
4c5b084525
commit
ab10bc69d7
Loading…
Reference in new issue