| 1234567891011 |
- package middleware
- import "net/http"
- // ContentTypeJSON sets the content type for requests to application/json
- func ContentTypeJSON(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json;charset=utf8")
- next.ServeHTTP(w, r)
- })
- }
|