devashishdxt / tonic-web-wasm-client

Other
104 stars 28 forks source link

Headers arent set when running in a real browser #41

Closed stan-irl closed 1 year ago

stan-irl commented 1 year ago

Im pretty sure this is because of the way you're binding to fetch here

Im finding that when i load my wasm in the browser and trigger a request the endpoint is correct but no headers are set. I tried to append some random headers and they also didnt come out.

I was able to fix this by changing the way you call fetch here to the following:

        let window = web_sys::window().unwrap();
        window.fetch_with_request_and_init(request, &init)

but that obviously doesnt work during SSR.

stan-irl commented 1 year ago

See my comment here

Apologies again 🙏