mirror of
https://github.com/gomods/athens
synced 2026-02-03 09:50:31 +00:00
Set correct Content-Type headers on each endpoint rather than on the router. The router would, at times, send two Content-Type headers and other times just send the wrong one.
17 lines
404 B
Go
17 lines
404 B
Go
package actions
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gomods/athens/pkg/storage"
|
|
)
|
|
|
|
func getReadinessHandler(s storage.Backend) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
if _, err := s.List(r.Context(), "github.com/gomods/athens"); err != nil {
|
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
}
|
|
}
|
|
}
|