Skip to content

Commit

Permalink
Use reqwest build_split
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Apr 9, 2023
1 parent ff670c5 commit ac6b2a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 3 additions & 8 deletions object_store/src/aws/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,8 @@ impl CredentialExt for RequestBuilder {
sign_payload: bool,
payload_sha256: Option<Vec<u8>>,
) -> Self {
// Hack around lack of access to underlying request
// https://github.com/seanmonstar/reqwest/issues/1212
let mut request = self
.try_clone()
.expect("not stream")
.build()
.expect("request valid");
let (client, request) = self.build_split();
let mut request = request.expect("request valid");

let date = Utc::now();
let signer = RequestSigner {
Expand All @@ -206,7 +201,7 @@ impl CredentialExt for RequestBuilder {
self = self.header(*header, val)
}
}
self
Self::from_parts(client, request)
}
}

Expand Down
11 changes: 3 additions & 8 deletions object_store/src/azure/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,8 @@ impl CredentialExt for RequestBuilder {
.header(DATE, &date_val)
.header(&VERSION, &AZURE_VERSION);

// Hack around lack of access to underlying request
// https://github.com/seanmonstar/reqwest/issues/1212
let request = self
.try_clone()
.expect("not stream")
.build()
.expect("request valid");
let (client, request) = self.build_split();
let mut request = request.expect("request valid");

match credential {
AzureCredential::AccessKey(key) => {
Expand All @@ -156,7 +151,7 @@ impl CredentialExt for RequestBuilder {
}
};

self
Self::from_parts(client, request)
}
}

Expand Down

0 comments on commit ac6b2a4

Please sign in to comment.