diff --git a/src/server/router/router_openfalcon.go b/src/server/router/router_openfalcon.go index 14bcbe5c..c7606585 100644 --- a/src/server/router/router_openfalcon.go +++ b/src/server/router/router_openfalcon.go @@ -142,9 +142,10 @@ func (m *FalconMetric) ToProm() (*prompb.TimeSeries, string, error) { func falconPush(c *gin.Context) { var bs []byte var err error + var r *gzip.Reader if c.GetHeader("Content-Encoding") == "gzip" { - r, err := gzip.NewReader(c.Request.Body) + r, err = gzip.NewReader(c.Request.Body) if err != nil { c.String(400, err.Error()) return diff --git a/src/server/router/router_opentsdb.go b/src/server/router/router_opentsdb.go index f8a61fce..f8eeaa60 100644 --- a/src/server/router/router_opentsdb.go +++ b/src/server/router/router_opentsdb.go @@ -125,9 +125,10 @@ func (m *HTTPMetric) ToProm() (*prompb.TimeSeries, error) { func handleOpenTSDB(c *gin.Context) { var bs []byte var err error + var r *gzip.Reader if c.GetHeader("Content-Encoding") == "gzip" { - r, err := gzip.NewReader(c.Request.Body) + r, err = gzip.NewReader(c.Request.Body) if err != nil { c.String(400, err.Error()) return