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

Conditional Compile Required for Requests #53

Closed
cjs-axsh opened this issue Feb 16, 2024 · 0 comments · Fixed by #54
Closed

Conditional Compile Required for Requests #53

cjs-axsh opened this issue Feb 16, 2024 · 0 comments · Fixed by #54

Comments

@cjs-axsh
Copy link

cjs-axsh commented Feb 16, 2024

This may be intended behavior since the suggestion in #51 seems to recommend it explicitly. But after #52, instantiating Request needs a conditional compile if targeting both wasm and native to account for the new mode field.

This was also more difficult to figure out than necessary because the docs don't have a wasm platform listed -- so the mode field is just not present anywhere on https://docs.rs/ehttp/latest/ehttp/struct.Request.html regardless of platform target choice.

The workaround of adding

#[cfg(target_arch = "wasm32")]
mode: ehttp::Mode::Cors,

to all Request instantiations is not all that bad, but the lack of documentation makes it more cumbersome than it needs to be. Maybe deriving default for Request would make it a little more clean, but still the lack of documentation seems to be the main issue.

I don't have any suggestions for a real fix, maybe something simple like adding a mode field for native as well? Anyway, feel free to close this issue if things are working as intended for everyone else.

@emilk emilk closed this as completed in #54 Feb 17, 2024
emilk added a commit that referenced this issue Feb 17, 2024
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.

1 participant