Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of RequestMode on wasm #51

Closed
afonsolage opened this issue Feb 13, 2024 · 2 comments · Fixed by #52
Closed

Allow configuration of RequestMode on wasm #51

afonsolage opened this issue Feb 13, 2024 · 2 comments · Fixed by #52

Comments

@afonsolage
Copy link
Contributor

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
Copy link
Owner

emilk commented Feb 13, 2024

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
Copy link
Contributor Author

Done! #52

@emilk emilk closed this as completed in #52 Feb 13, 2024
emilk added a commit that referenced this issue Feb 13, 2024
Closes #51 

- Add `Mode` to `Request` on wasm builds;
- Add `Mode::Cors` as default;

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants