Commit 9ece10ef by bergquist

style(dataproxy): simplify expression

parent b386920a
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment