Fork me on GitHub
#clojurescript
<
2022-12-23
>
hifumi12310:12:20

Does anyone know how to get cljs-http to return all headers from a response? My CORS header allow all headers to be sent, yet I'm only getting "content-length" returned in my response map. But when I inspect the XHR response in dev tools, I clearly see "Set-Cookie" headers that I need to access in my cljs code

p-himik10:12:09

If those cookies are secure, you can't access them from JS - that's how modern browsers work due to security concerns. If they aren't marked as secure, I'm 70% sure you still can't access them from JS, but I'd have to confirm that.

hifumi12310:12:04

Looks like I get the same issue with fetch... and I pinned it down to my :credentials key seemingly not working. Or I am misunderstanding its purpose

hifumi12310:12:08

(fetch/post endpoint {:credentials :include ...})
is what I am running... it sends the request to backend where I allow all methods, origins, and credentials for CORS, The frontend and backend are separate servers but they run on the same machine, just on a different port.

hifumi12311:12:46

Upon further prying into the backend and how cookies work, I realized this is not a CLJS problem at all. The cookies are being sent from the backend with an HttpOnly attribute. This makes the token I receive from the server are completely inaccessible from JS. Woops.

👍 1
Steph Crown15:12:32

Hi guys. Is there a ClojureScript function i can use to convert HTML to Hiccup?

Miķelis Vindavs15:12:09

not in core, but you can use a library such as https://github.com/clj-commons/hickory

1
👍 1
pesterhazy16:12:33

For one offs

Jacob Emcken07:01:43

or https://html2hiccup.dev/ which doesn't suffer from the issues: • SVG attributes aren't camel-cased • <a href=""> transforms to invalid hiccup [:a {:href }] • HTML comments should become Clojure comments