pimeys / rust-web-push

A Web Push library for Rust
Apache License 2.0
113 stars 21 forks source link

feature request: add ability to use proxy #56

Closed naskya closed 4 months ago

naskya commented 5 months ago

Thank you for creating/maintaining this nice project!

While isahc provides various features including proxied requests, if I understand correctly, we can’t use these features in this crate because the only way to create an IsahcWebPushClient instance is IsahcWebPushClient::new(), which just wraps isahc::HttpClient::new(), keeping the default settings.

It would be really nice if we could use our custom isahc::HttpClient instance like:

let custom_isahc_client = isahc::HttpClientBuilder::new().proxy(proxy).build()?;
let client = IsahcWebPushClient::from(custom_isahc_client);

or allowing just a small subset of the isahc features would be helpful enough:

let client = IsahcWebPushClientBuilder::new().proxy(proxy_url).build()?;
andyblarblar commented 4 months ago

I think that from implimentation should be trivial. Not sure if I'll be able to get to it soon (just graduated, so quite busy!), but there should be no reason why this library's strucuture should make that infeasible.

naskya commented 4 months ago

Thank you for your reply! I’m glad to hear your positive feedback on my request.

Not sure if I'll be able to get to it soon (just graduated, so quite busy!)

No worries! I’m opening a pull request, so please review it when you (or other maintainers) have time.