1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(api): add json content-type to all json API responses (#1809)

This commit is contained in:
Igor Karpovich 2018-04-13 15:01:02 +01:00 committed by Anthony Lapenna
parent 4f0e752d00
commit 7690ef3c33
2 changed files with 2 additions and 0 deletions

View file

@ -17,6 +17,7 @@ func WriteErrorResponse(w http.ResponseWriter, err error, code int, logger *log.
logger.Printf("http error: %s (code=%d)", err, code)
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(&errorResponse{Err: err.Error()})
}