mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting/Chore: Mock API (MSW) in browser (#89223)
Co-authored-by: joshhunt <josh@trtr.co>
This commit is contained in:
@@ -604,6 +604,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
hs.mapStatic(m, hs.Cfg.StaticRootPath, "build", "public/build")
|
||||
hs.mapStatic(m, hs.Cfg.StaticRootPath, "", "public", "/public/views/swagger.html")
|
||||
hs.mapStatic(m, hs.Cfg.StaticRootPath, "robots.txt", "robots.txt")
|
||||
hs.mapStatic(m, hs.Cfg.StaticRootPath, "mockServiceWorker.js", "mockServiceWorker.js")
|
||||
|
||||
if hs.Cfg.ImageUploadProvider == "local" {
|
||||
hs.mapStatic(m, hs.Cfg.ImagesDir, "", "/public/img/attachments")
|
||||
@@ -753,6 +754,12 @@ func (hs *HTTPServer) mapStatic(m *web.Mux, rootDir string, dir string, prefix s
|
||||
}
|
||||
}
|
||||
|
||||
if prefix == "mockServiceWorker.js" {
|
||||
headers = func(c *web.Context) {
|
||||
c.Resp.Header().Set("Content-Type", "application/javascript")
|
||||
}
|
||||
}
|
||||
|
||||
m.Use(httpstatic.Static(
|
||||
path.Join(rootDir, dir),
|
||||
httpstatic.StaticOptions{
|
||||
|
||||
Reference in New Issue
Block a user