erigon-pulse/cl/beacon/middleware.go

18 lines
421 B
Go
Raw Normal View History

package beacon
import (
"net/http"
)
func newBeaconMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
contentType := r.Header.Get("Content-Type")
if contentType != "application/json" && contentType != "" {
http.Error(w, "Content-Type header must be application/json", http.StatusUnsupportedMediaType)
return
}
next.ServeHTTP(w, r)
})
}