I make a request like so using clj-http.client
(http/get "https://www.example.com/bar")
and get a response with status 200.
However, when I make the same request with cljs-http.client like so:
(go (let [response (<! (http/get (str "https://example.com" "/bar")))]
(prn response)))
I get a response with status 0, and in the browser it says that it's been blocked by the cors policy.
Why would the cljs-http.client request be blocked by the cors policy if the clj-http.client request isn't?
(defn response [data & [status]]
{:status (or status 200)
:headers {"Content-Type" "application/edn"
"Access-Control-Allow-Headers" "Content-Type"
"Access-Control-Allow-Origin" "*"
"Access-Control-Request-Method" "GET"}
:body (pr-str data)})
I wrap my response for route "bar" with the function response above.