mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
style(dataproxy): simplify expression
This commit is contained in:
@@ -109,7 +109,7 @@ func ProxyDataSourceRequest(c *middleware.Context) {
|
|||||||
proxyPath := c.Params("*")
|
proxyPath := c.Params("*")
|
||||||
|
|
||||||
if ds.Type == m.DS_PROMETHEUS {
|
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)
|
c.JsonApiErr(403, "GET is only allowed on proxied Prometheus datasource", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user