Enable cookies in wasm32
This PR adds cookie support for wasm targets.
hey I'm interested in this, is there anything I can do to help ?
I've updated this branch and disabled my toml autoformatter. Hopefully it should clear CI now. Sorry for the wait :) ping @seanmonstar
+1 on this -- hope to see it merged soon.
@seanmonstar Hey - would love to get your re-review of this since a handful of people have reached out to me about this. Thanks!
Bumping @seanmonstar
Are we certain this is working as expected? It might be something else on my side that is not working correctly, but I have an authentication-related test case that works when I run the program in a non-wasm context, but when I compile to wasm, and run it in a browser, the authentication fails. I haven't dug deep yet to figure out what is going on, but the first thing that jumps out at me is that if the cookie jar isn't working as expected (e.g. cookies returned from request 1 need to be set in request 2), the authentication request fails.
I hope to find some more time this week to verify if it is indeed the cookie jar that is behaving differently between non-wasm and wasm, or if it's something else entirely unrelated to this PR.
edit Actually, I did quickly validate that indeed, the cookie jar is empty on the Wasm target, but not on the native local target. I don't know why that's the case yet, it might still be that the first request actually didn't return any cookies to store in the jar, but I find that highly unlikely, since both targets do the same query to the same endpoint.
edit 2 I just validated that indeed, both on the wasm and non-wasm target, the first response has a set-cookie header, but on the wasm target, that cookie is not added to the cookie jar, while that does happen on the non-wasm target.
Any updates? The crates should have all been updated, right?
I'm not certain what the status is, actually. It sounds like this needs something from cookie_store? Or from time? Or are all those things fine now? Is the rabbit hole @JeanMertz fell in the same thing?
A new feature flag in time was introduced which (I believe) allows it to build w/ the wasm target. cookie_store has been updated to this version of time, and itself exposes a new feature flag wasm-bindgen for enabling the transitive time/wasm-bindgen feature.
Per #1674 , there is some impedance to making the upgrade; it may simply be the updated time dependency needing a higher MSRV that reqwest currently targets? I have followed up in that issue to see if there is a deeper problem.
I personally don't target wasm, so if there are further changes needed to support this in cookie_store that I am missing, users may comment at the existing pfernie/cookie_store#26