Skip to content

Commit

Permalink
fix: workaround for compression handling bug in the Grafana SDK's HTT…
Browse files Browse the repository at this point in the history
…P client
  • Loading branch information
amlmtl committed Nov 16, 2023
1 parent 13840bb commit 046eda8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ func callDiscoveryEndpoint(ctx context.Context, httpClient *http.Client, discove
return nil, err
}

if request.Header.Get("Accept-Encoding") == "" {
// Grafana (as of version 9.x) contains a bug where it will enable compression by adding an explicit Accept-Encoding header by default if missing,
// but not properly handle decompression of any compressed response.
// The header set explicitly here as a workaround for this bug.
request.Header.Set("Accept-Encoding", "identity")
}

resp, err := httpClient.Do(request)
if err != nil {
log.DefaultLogger.Error("Unable to receive discovery response.", "error", err)
Expand Down

0 comments on commit 046eda8

Please sign in to comment.