From b0a8cfa8a75498707605071815beb7ca3d6a1ef9 Mon Sep 17 00:00:00 2001 From: Alvaro Jose Date: Tue, 15 Oct 2019 20:33:13 +0000 Subject: [PATCH] Issue-37 | Alvaro | Add cors headers https://github.com/rdegges/ipify-api/issues/37 --- api/get_ip.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/get_ip.go b/api/get_ip.go index 2020f50..3fd32b8 100644 --- a/api/get_ip.go +++ b/api/get_ip.go @@ -36,6 +36,7 @@ func GetIP(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { // user's IP address in the specified format. if format, ok := r.Form["format"]; ok && len(format) > 0 { jsonStr, _ := json.Marshal(models.IPAddress{ip}) + w.Header().Set("Access-Control-Allow-Origin", "*") switch format[0] { case "json":