Skip to content

Commit

Permalink
Set correct CORS header in API endpoint.
Browse files Browse the repository at this point in the history
The correct header string is 'Access-Control-Allow-Origin'.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
  • Loading branch information
fxb committed Feb 5, 2015
1 parent 387607a commit e3f446c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hound/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Stats struct {

func writeJson(w http.ResponseWriter, data interface{}) {
w.Header().Set("Content-Type", "application/json;charset=utf-8")
w.Header().Set("Access-Control-Allow", "*")
w.Header().Set("Access-Control-Allow-Origin", "*")
if err := json.NewEncoder(w).Encode(data); err != nil {
log.Panicf("Failed to encode JSON: %v\n", err)
}
Expand Down

0 comments on commit e3f446c

Please sign in to comment.