Skip to content
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
12 changes: 4 additions & 8 deletions src/h1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use http_types::StatusCode;

/// Async-h1 based HTTP Client.
#[derive(Debug)]
pub struct H1Client {}
pub struct H1Client {
_priv: (),
}

impl Default for H1Client {
fn default() -> Self {
Expand All @@ -18,13 +20,7 @@ impl Default for H1Client {
impl H1Client {
/// Create a new instance.
pub fn new() -> Self {
Self {}
}
}

impl Clone for H1Client {
fn clone(&self) -> Self {
Self {}
Self { _priv: () }
}
}

Expand Down
19 changes: 3 additions & 16 deletions src/isahc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ use super::{async_trait, Body, Error, HttpClient, Request, Response};

use async_std::io::BufReader;
use isahc::http;
use std::sync::Arc;

/// Curl-based HTTP Client.
#[derive(Debug)]
pub struct IsahcClient {
client: Arc<isahc::HttpClient>,
}
pub struct IsahcClient(isahc::HttpClient);

impl Default for IsahcClient {
fn default() -> Self {
Expand All @@ -26,17 +23,7 @@ impl IsahcClient {

/// Create from externally initialized and configured client.
pub fn from_client(client: isahc::HttpClient) -> Self {
Self {
client: Arc::new(client),
}
}
}

impl Clone for IsahcClient {
fn clone(&self) -> Self {
Self {
client: self.client.clone(),
}
Self(client)
}
}

Expand All @@ -59,7 +46,7 @@ impl HttpClient for IsahcClient {
};

let request = builder.body(body).unwrap();
let res = self.client.send_async(request).await.map_err(Error::from)?;
let res = self.0.send_async(request).await.map_err(Error::from)?;
let (parts, body) = res.into_parts();
let len = body.len().map(|len| len as usize);
let body = Body::from_reader(BufReader::new(body), len);
Expand Down
6 changes: 0 additions & 6 deletions src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ impl WasmClient {
}
}

impl Clone for WasmClient {
fn clone(&self) -> Self {
Self { _priv: () }
}
}

impl HttpClient for WasmClient {
fn send<'a, 'async_trait>(
&'a self,
Expand Down