mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
Merge pull request #605 from gocsaf/dev-17
fix: Content-Type header for JSON responses (minor)
This commit is contained in:
commit
5907a391df
1 changed files with 1 additions and 1 deletions
|
|
@ -174,7 +174,7 @@ func (c *controller) web(
|
||||||
// writeJSON sets the header for the response and writes the JSON encoding of the given "content".
|
// writeJSON sets the header for the response and writes the JSON encoding of the given "content".
|
||||||
// It logs out an error message in case of an error.
|
// It logs out an error message in case of an error.
|
||||||
func writeJSON(rw http.ResponseWriter, content any, code int) {
|
func writeJSON(rw http.ResponseWriter, content any, code int) {
|
||||||
rw.Header().Set("Content-type", "application/json; charset=utf-8")
|
rw.Header().Set("Content-type", "application/json")
|
||||||
rw.Header().Set("X-Content-Type-Options", "nosniff")
|
rw.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
rw.WriteHeader(code)
|
rw.WriteHeader(code)
|
||||||
if err := json.NewEncoder(rw).Encode(content); err != nil {
|
if err := json.NewEncoder(rw).Encode(content); err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue