Skip to content

Commit

Permalink
fix: ensure headers are written correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed Mar 5, 2018
1 parent e0fe738 commit 7118624
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions boom.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func boom(w http.ResponseWriter, statusCode int, args ...interface{}) {
}
}

w.Header().Set("Content-Type", "application/json; charset=UTF-8")

errString, _ := json.Marshal(boomErr{
errorType,
message,
statusCode,
})

http.Error(w, string(errString), statusCode)
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(statusCode)
w.Write(errString)
}

0 comments on commit 7118624

Please sign in to comment.