http-rs / http-rs/surf

Default to using wasm-client when targeting wasm

Open
#253 18 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Say I make a crate which is a binding to a web API, and I choose to use Surf as the http client in this API.

Currently, you must manually define if you want to target wasm with a feature flag (`wasm-client`).

However, if I make changes to the feature flags in the crate, anyone who uses the crate as a dependency has to live with that decision. Cargo does not allow you to change feature flags defined in your dependencies dependencies.

This means that if you want your crate to be accessible in a desktop application with a native HTTP client, and simultaneously also usable in a WASM application, Surf isn't currently capable of simultaneously supporting both uses cases without publishing two different crates with different Surf variations.

Honestly, it'd be nice if we have a generic HTTP client trait that crates could use so that it wouldn't matter what HTTP client the caller is using with their API.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.