package mw import "net/http" // JsonContentType sets Content-Type: application/json on all API responses. // Individual handlers that need to override (e.g. binary/image responses) // should set their own Content-Type header after this middleware runs. func JsonContentType(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") next.ServeHTTP(w, r) }) }