Skip to content

Commit

Permalink
feat(Connection): validate_server is now static method
Browse files Browse the repository at this point in the history
BREAKING CHANGE: validate_server is now a static method
  • Loading branch information
fMeow committed Jul 26, 2020
1 parent 20d2505 commit e908d47
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ impl<S, C: ClientExt> GenericConnection<C, S> {
/// - Connection failed
/// - SERVER header in response header is not `ArangoDB` or empty
#[maybe_async]
pub async fn validate_server(&self) -> Result<(), ClientError> {
let arango_url = self.arango_url.as_str();
let client = &self.session;
pub async fn validate_server(arango_url:&str) -> Result<(), ClientError> {
let client = C::new(None)?;
let resp = client.get(arango_url.parse().unwrap(), "").await?;
// have `Server` in header
match resp.headers().get(SERVER) {
Expand Down Expand Up @@ -193,7 +192,7 @@ impl<C: ClientExt> GenericConnection<C, Normal> {
session: Arc::new(C::new(None)?),
state: Normal,
};
conn.validate_server().await?;
Self::validate_server(&url).await?;

let user: String;
let authorization = match auth {
Expand Down

0 comments on commit e908d47

Please sign in to comment.