Skip to content

Publicly re-export "reqwest" to fix version mismatch in post_graphql #554

@nothingnesses

Description

@nothingnesses

Hi. I'm trying to use the post_graphql function with the "reqwest" feature enabled. Even though my project depends on both this library and "reqwest", I'm hitting the "two different versions of crate `reqwest`" error. As such, I can't construct a reqwest::Client that post_graphql accepts.

Suggested Solution

Could we add a re-export of the "reqwest" crate when the feature is enabled?

I.e, in "src/graphql_client/reqwest.rs":

#[cfg(feature = "reqwest")]
pub use reqwest_crate as reqwest;

This should allow downstream users to do the following:

// Use the exact version of reqwest that graphql_client expects.
use graphql_client::reqwest::{Client, post_graphql};

let client = Client::new();
// This should now work.
post_graphql(&client, ...);

For now, I'm manually copying the function implementation into my project to bypass the type mismatch, but a re-export would be much cleaner and more user-friendly.

I'd be happy to implement this fix and make a PR myself, but let me know if there's a different approach you'd prefer, or if you think I'm missing something obvious that'd let me use post_graphql without relying on my work-around.

In any case, thanks for the library!

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