Skip to content

Commit

Permalink
exposes surf's with_http_client
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlaltf24 committed Oct 4, 2021
1 parent d5a383a commit 0bba55e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion influxdb/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use http::StatusCode;
#[cfg(feature = "reqwest")]
use reqwest::{Client as HttpClient, Response as HttpResponse};
#[cfg(feature = "surf")]
use surf::{Client as HttpClient, Response as HttpResponse};
use surf::{Client as HttpClient, HttpClient as SurfHttpClient, Response as HttpResponse};

use crate::query::QueryType;
use crate::Error;
Expand Down Expand Up @@ -91,6 +91,13 @@ impl Client {
self
}

/// Allows creation of custom http clients
#[cfg(feature = "surf")]
pub fn with_http_client<T: SurfHttpClient>(mut self, http_client: T) -> Self {
self.client = HttpClient::with_http_client(http_client);
self
}

/// Returns the name of the database the client is using
pub fn database_name(&self) -> &str {
// safe to unwrap: we always set the database name in `Self::new`
Expand Down

0 comments on commit 0bba55e

Please sign in to comment.