Skip to content

Commit

Permalink
Merge pull request openshift#60 from nmonterroso/master
Browse files Browse the repository at this point in the history
only set the Content-Type header when one hasn't already been set
  • Loading branch information
RangelReale committed May 27, 2015
2 parents eff0d43 + 51f35a8 commit 6531cf7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions response_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ func OutputJSON(rs *Response, w http.ResponseWriter, r *http.Request) error {
w.Header().Add("Location", u)
w.WriteHeader(302)
} else {
// Output json
w.Header().Add("Content-Type", "application/json")
// set content type if the response doesn't already have one associated with it
if w.Header().Get("Content-Type") == "" {
w.Header().Set("Content-Type", "application/json")
}
w.WriteHeader(rs.StatusCode)

encoder := json.NewEncoder(w)
Expand Down

0 comments on commit 6531cf7

Please sign in to comment.