Reputation: 1824
Full body of error message:
Access to XMLHttpRequest at 'xxx' from origin 'http://localhost:8281' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
I am using the cljs-http package and following the docs. I have set with-credentials
to false, but the error message is saying it thinks they are set to include
?
Here is my code:
(go (let [response (<! (http/get API-URL
{:with-credentials? false
:headers {"Content-Type": "application/json"}}))]
(js/console.log (:status response))
(js/console.log (map :login (:body response))))))
How should I structure / what should I include on the request?
Upvotes: 0
Views: 315
Reputation: 1824
I removed the colon from the Content-Type
header and also the map
and now the codes works:
(go (let [response (<! (http/get API-URL
{:with-credentials? false
:headers {"Content-Type" "application/json"}}))]
(js/console.log (:status response))
(js/console.log (:body response)))))
Upvotes: 1