diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-09-11 12:11:10 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-09-12 10:26:24 -0400 |
commit | 27e59c32f933e6b52a01a73b774e6b0ade0d1d4d (patch) | |
tree | 08cf5c767fc69eacee5c58e46c7f7bd0e03392ac | |
parent | 7f491bdb17bb76855cd6f3ddc0bbf81281ceaaec (diff) | |
download | chat-27e59c32f933e6b52a01a73b774e6b0ade0d1d4d.tar.gz chat-27e59c32f933e6b52a01a73b774e6b0ade0d1d4d.tar.bz2 chat-27e59c32f933e6b52a01a73b774e6b0ade0d1d4d.zip |
Set default Content-Type to application/json for all API requests
-rw-r--r-- | api/context.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go index aaf304e2c..ac5dbc7ec 100644 --- a/api/context.go +++ b/api/context.go @@ -106,6 +106,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if !h.isApi { w.Header().Set("X-Frame-Options", "DENY") w.Header().Set("Content-Security-Policy", "frame-ancestors none") + } else { + // All api response bodies will be JSON formatted + w.Header().Set("Content-Type", "application/json") } sessionId := "" |