mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 21:27:19 +00:00
d9c0e65cef
* info logs beacon node improvements * prom test fixes * info logging changes * wrapped up node info logging * changed to debug level * warn logs taken care of * Terence suggestion * warn spacing * better logging in initial sync * debug level standardized * complete debug standardization * participation at epoch end * fix archive tests * even more test fixes * prom test * ops test * powtest * rpc sync test * rem part * log formatting
27 lines
634 B
Go
27 lines
634 B
Go
package gateway
|
|
|
|
import (
|
|
"net/http"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
// Swagger directory for the runtime files provided by bazel data.
|
|
const swaggerDir = "proto/beacon/rpc/v1/"
|
|
|
|
// SwaggerServer returns swagger specification files located under "/swagger/"
|
|
func SwaggerServer() http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
if !strings.HasSuffix(r.URL.Path, ".swagger.json") {
|
|
log.Debugf("Not found: %s", r.URL.Path)
|
|
http.NotFound(w, r)
|
|
return
|
|
}
|
|
|
|
log.Debugf("Serving %s\n", r.URL.Path)
|
|
p := strings.TrimPrefix(r.URL.Path, "/swagger/")
|
|
p = path.Join(swaggerDir, p)
|
|
http.ServeFile(w, r, p)
|
|
}
|
|
}
|