about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-23 12:32:06 +0200
committerEmile <hanemile@protonmail.com>2019-10-23 12:32:06 +0200
commit091c205f0b584aea72ad7259efd383b657329dbf (patch)
treeebe22a93cdd64fa6a29f8b218725f4c94f877579
parent5eb4afe0a261e5aeca56b24191bc8a84570e7ff8 (diff)
added the access-controll-allow-origin header to the response of the getChallenges endpoint
-rw-r--r--src/http.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/http.go b/src/http.go
index 27bea85..0eadd57 100644
--- a/src/http.go
+++ b/src/http.go
@@ -259,6 +259,7 @@ func readFileToResponse(w http.ResponseWriter, path string) {
 
 // getChallenges returns all challenges
 func getChallenges(w http.ResponseWriter, r *http.Request) {
+
 	challenges := dbGetAllChallenges()
 
 	var strippedChallenges []StrippedChallenge
@@ -284,6 +285,7 @@ func getChallenges(w http.ResponseWriter, r *http.Request) {
 	// set the json header and write the marshaled challenges to the response
 	// writer
 	w.Header().Set("Content-Type", "application/json")
+	w.Header().Set("Access-Control-Allow-Origin", "*")
 	fmt.Fprintf(w, string(marshalled))
 }