Skip to content

Default to using wasm-client when targeting wasm #253

Open
@mmstick

Description

@mmstick

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions