Fix middleware tests for public dashboards (#53557)

This commit is contained in:
Guilherme Caulada 2022-08-10 18:12:25 -03:00 committed by GitHub
parent 7924d3b3b5
commit 7554322327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,14 @@ func runMiddleware(request *http.Request, pubdashService *publicdashboardsServic
initCtx.Context = c
c.Req = c.Req.WithContext(ctxkey.Set(c.Req.Context(), initCtx))
})
m.Get("/api/public/ma/events/:accessToken", RequiresValidAccessToken(pubdashService))
m.Get("/api/public/ma/events/:accessToken", RequiresValidAccessToken(pubdashService), mockValidRequestHandler)
m.ServeHTTP(recorder, request)
return recorder
}
func mockValidRequestHandler(c *models.ReqContext) {
resp := make(map[string]interface{})
resp["message"] = "Valid request"
c.JSON(http.StatusOK, resp)
}