diff --git a/http/server.go b/http/server.go index 4180208..44ad019 100644 --- a/http/server.go +++ b/http/server.go @@ -85,6 +85,7 @@ func handlerFunc(schema types.Schema) httprouter.Handle { log.Infof("request: %s %s", r.Method, r.URL) log.Infof("response status: %d, body: %s", schema.Status, schema.Response) + w.Header().Add("Access-Control-Allow-Origin", "*") w.Header().Add("Content-Type", "application/json") w.WriteHeader(schema.Status) _, ok := r.URL.Query()["pretty"] diff --git a/http/server_test.go b/http/server_test.go index 85b1e6c..1242bd8 100644 --- a/http/server_test.go +++ b/http/server_test.go @@ -69,6 +69,7 @@ func TestServer_Watch(t *testing.T) { resp := httptest.NewRecorder() server.router.ServeHTTP(resp, req) + assert.Equal(t, "*", resp.Header().Get("Access-Control-Allow-Origin")) assert.Equal(t, "application/json", resp.Header().Get("Content-Type")) assert.Equal(t, schema.Status, resp.Code)