emilk / ehttp

Minimal Rust HTTP client for both native and WASM
Apache License 2.0
316 stars 30 forks source link

Allow configuration of `RequestMode` on wasm #51

Closed afonsolage closed 7 months ago

afonsolage commented 7 months ago

Whenever I need to test a local wasm, I kept getting CORS errors since all requests uses mode cors (https://github.com/emilk/ehttp/blob/master/ehttp/src/web.rs#L45C5-L45C43). It would be nice to be able to configure on request which mode we would like to use, like no-cors.

This only affects wasm, tho, since CORS is something only available on browsers.

emilk commented 7 months ago

Good idea! Would you like to make a PR?

I suggest we use an enum for this that one can set on ehttp::Request, and that is simply ignored on native.

afonsolage commented 7 months ago

Done! #52