summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-09-14 08:19:51 -0400
committerChristopher Speller <crspeller@gmail.com>2015-09-14 08:19:51 -0400
commit447363262e7486c0ad88360c6b77208d0606bd6d (patch)
treed26f3b735b865ac6256df048db2647092560a7d1
parenta9a7efbe9833f4b222b79bcf3aa39dc26eb470ad (diff)
parent27e59c32f933e6b52a01a73b774e6b0ade0d1d4d (diff)
downloadchat-447363262e7486c0ad88360c6b77208d0606bd6d.tar.gz
chat-447363262e7486c0ad88360c6b77208d0606bd6d.tar.bz2
chat-447363262e7486c0ad88360c6b77208d0606bd6d.zip
Merge pull request #655 from mattermost/content-type
Set default Content-Type to application/json for all API requests
-rw-r--r--api/context.go3
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 := ""