Skip to content

Commit 0bba55e

Browse files
committed
exposes surf's with_http_client
1 parent d5a383a commit 0bba55e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

influxdb/src/client/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use http::StatusCode;
2020
#[cfg(feature = "reqwest")]
2121
use reqwest::{Client as HttpClient, Response as HttpResponse};
2222
#[cfg(feature = "surf")]
23-
use surf::{Client as HttpClient, Response as HttpResponse};
23+
use surf::{Client as HttpClient, HttpClient as SurfHttpClient, Response as HttpResponse};
2424

2525
use crate::query::QueryType;
2626
use crate::Error;
@@ -91,6 +91,13 @@ impl Client {
9191
self
9292
}
9393

94+
/// Allows creation of custom http clients
95+
#[cfg(feature = "surf")]
96+
pub fn with_http_client<T: SurfHttpClient>(mut self, http_client: T) -> Self {
97+
self.client = HttpClient::with_http_client(http_client);
98+
self
99+
}
100+
94101
/// Returns the name of the database the client is using
95102
pub fn database_name(&self) -> &str {
96103
// safe to unwrap: we always set the database name in `Self::new`

0 commit comments

Comments
 (0)