From d4a96b9741e569568900da80e5aa96b8fa387f8d Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 16 Jan 2017 12:24:08 +0100 Subject: [PATCH] tech(dataproxy): make the code a little bit more defensive --- pkg/api/dataproxy.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/api/dataproxy.go b/pkg/api/dataproxy.go index a5c047d95ff..dfdc867d4a4 100644 --- a/pkg/api/dataproxy.go +++ b/pkg/api/dataproxy.go @@ -139,9 +139,10 @@ func logProxyRequest(dataSourceType string, c *middleware.Context) { return } - var body string - if c.Req.Request.Body != nil { - buffer, _ := ioutil.ReadAll(c.Req.Request.Body) + var body string + if c.Req.Request.Body != nil { + buffer, err := ioutil.ReadAll(c.Req.Request.Body) + if err == nil { c.Req.Request.Body = ioutil.NopCloser(bytes.NewBuffer(buffer)) body = string(buffer) }