mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +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.
15 lines
303 B
Go
15 lines
303 B
Go
package actions
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/gomods/athens/pkg/build"
|
|
)
|
|
|
|
func versionHandler(w http.ResponseWriter, r *http.Request) {
|
|
_ = json.NewEncoder(w).Encode(build.Data())
|
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
w.WriteHeader(http.StatusOK)
|
|
}
|