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
add ClientBuilder.default_headers() for wasm32 target #1084
Conversation
…t, disable tests that depend on tokio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to add the general feature, thanks! A few thoughts inline...
partially addresses issue #657 |
There's another possible way to address the example builds .. If we add async-std to the dev-dependencies, this code compiles with and without target=wasm32
We could also add a comment to explain that reqwest compiles fine with wasm, it's just tokio runtime that is incompatible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated per your suggestion - examples build automatically now
Added ClientBuilder.default_headers to wasm, with a couple unit tests.
To make the wasm32 unit tests not generate a barrage of errors for non-wasm code, I added some #cfg gates to some tests in the tests/ folder. Cargo doesn't support target-specific examples, so I had to disable default build of two of the examples that depend on
tokio::test
.Unfortunately this will require adding one more step to your CI actions:
cargo build --examples --features __examples
To run the wasm unit tests, use
wasm-pack test --firefox --headless