From 9ece10ef248fc3ea4dc49e56814abc6d98c0fb76 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 7 Feb 2017 11:03:57 +0100 Subject: [PATCH] style(dataproxy): simplify expression --- pkg/api/dataproxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/dataproxy.go b/pkg/api/dataproxy.go index bc286743533..b72f676dbbc 100644 --- a/pkg/api/dataproxy.go +++ b/pkg/api/dataproxy.go @@ -109,7 +109,7 @@ func ProxyDataSourceRequest(c *middleware.Context) { proxyPath := c.Params("*") if ds.Type == m.DS_PROMETHEUS { - if !(c.Req.Request.Method == "GET" && strings.Index(proxyPath, "api/") == 0) { + if c.Req.Request.Method != http.MethodGet || !strings.HasPrefix(proxyPath, "api/") { c.JsonApiErr(403, "GET is only allowed on proxied Prometheus datasource", nil) return }