Conversation
38d0d3a to
5bbfb6c
Compare
|
@lescuer97 almost there, I think we should remove reqwuest all together and use this bits for wasm, using the native "fetch" function provided by the browser and bitreq for everything else |
I don't think we should remove reqwest all together. Can't we make use of a trait and then implement that trait for both bitreq and reqwest, it should only have a couple fns. We can then feature flag these implementations. Many projects already use reqwest so use reqwest within cdk would not be adding any deps and in fact using bitreq would. This would also make it easier for us to switch between the two as bitreq is still new we could encounter issues. |
2721921 to
940c1cb
Compare
projects already using reqwest is true. I had not think about it |
|
The reqwest feature needs to be added to the cdk and perhaps the mintd crates as well, since the http crate is not injected or cannot be provided externally. |
|
mintd we can just make the choice we don't need to give a feature. |
|
Even if we do not provide the feature externally, I still think it makes sense to do as a trait. Since we know we will have at least 2 impls even if we drop reqwest wasm and native. |
|
okey, just to clear thing up. I will then keep this code but add back the features for and reimplement the trait for reqwest. does this sound correct? |
|
I can help if you want, but I also believe the trait is a good idea and it should live in cdk-common perhaps. |
|
I just remembered we actually have 3 at minimum due to Tor. We already have a trait there maybe we can just move it and consolidate? |
|
@thesimplekid @crodas just to be clear on what to do next. I should keep the trait that already exists in the http package, then use that trait for the tor implementation also. possibly moving that code into the http crate. plus go back to use features. so users can decide to use either the reqwest or bitreq trait. |
|
We want to move the transport Trait to the http crate. Tor, bitreq and reqwest should all implement this each behind a feature in the http crate. The |
Remove the reqwest dependency from cdk-http-client and replace it with a native WASM fetch backend using wasm_bindgen + web_sys. The bitreq backend remains for native targets but is no longer behind a feature flag — it is always compiled on non-WASM via target_arch cfg. - Add wasm_backend.rs: WasmRequestBuilder, HttpClient, and HttpClientBuilder using js_fetch + web_sys::Request - Move HttpClient and HttpClientBuilder into their respective backend files to eliminate cfg gates on shared types - Remove reqwest_backend.rs and the reqwest/bitreq feature flags - Use cfg(target_arch = "wasm32") / cfg(not(...)) instead of features - Remove reqwest from workspace dependencies - Update cdk, cdk-common, cdk-prometheus Cargo.toml references
move and implemented the transport crate in the http crate c
Description
use bitreq for the non wasm targets and use reqwest for wasm. in the http client crate.
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committing