Skip to content

Commit

Permalink
fix(server): set Content-Type to JSON in label handlers (#1969)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota authored Jun 29, 2023
1 parent e58cb29 commit 4079d3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions pkg/server/labels.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package server

import (
"encoding/json"
"net/http"

"github.com/pyroscope-io/pyroscope/pkg/server/httputils"
Expand Down Expand Up @@ -39,11 +38,6 @@ func NewLabelsHandler(s storage.LabelsGetter, httpUtils httputils.Utils) http.Ha
})
}

b, err := json.Marshal(keys)
if err != nil {
httpUtils.WriteJSONEncodeError(r, w, err)
return
}
_, _ = w.Write(b)
httpUtils.WriteResponseJSON(r, w, keys)
}
}
8 changes: 1 addition & 7 deletions pkg/server/labelvalues.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package server

import (
"encoding/json"
"net/http"

"github.com/pyroscope-io/pyroscope/pkg/server/httputils"
Expand Down Expand Up @@ -45,11 +44,6 @@ func NewLabelValuesHandler(s storage.LabelValuesGetter, httpUtils httputils.Util
})
}

b, err := json.Marshal(values)
if err != nil {
httpUtils.WriteJSONEncodeError(r, w, err)
return
}
_, _ = w.Write(b)
httpUtils.WriteResponseJSON(r, w, values)
}
}

0 comments on commit 4079d3d

Please sign in to comment.