Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Http::new for reqwest::Client #434

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions crates/transport-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ pub struct Http<T> {
}

impl<T> Http<T> {
/// Create a new [`Http`] transport.
pub fn new(url: Url) -> Self
where
T: Default,
{
Self { client: Default::default(), url }
}

/// Create a new [`Http`] transport with a custom client.
pub const fn with_client(client: T, url: Url) -> Self {
Self { client, url }
Expand Down
6 changes: 6 additions & 0 deletions crates/transport-http/src/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ use alloy_transport::{TransportError, TransportErrorKind, TransportFut};
use reqwest::Response;
use std::task;
use tower::Service;
use url::Url;

impl Http<reqwest::Client> {
/// Create a new [`Http`] transport.
pub fn new(url: Url) -> Self {
Self { client: Default::default(), url }
}

/// Make a request.
fn request_reqwest(&self, req: RequestPacket) -> TransportFut<'static> {
let this = self.clone();
Expand Down
Loading