Skip to content

Commit

Permalink
data_lake
Browse files Browse the repository at this point in the history
  • Loading branch information
MindFlavor committed Jul 12, 2021
1 parent 17ed9a1 commit 62b7c76
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sdk/storage/src/data_lake/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ impl<'a, 'b> AddAsHeader for Properties<'a, 'b> {
) -> Result<(), azure_core::HTTPHeaderError> {
// the header is a comma separated list of key=base64(value) see
// [https://docs.microsoft.com/rest/api/storageservices/datalakestoragegen2/filesystem/create#request-headers](https://docs.microsoft.com/rest/api/storageservices/datalakestoragegen2/filesystem/create#request-headers)
let mut s = String::new();
self.0.iter().for_each(|(k, v)| {
s.push_str(&format!("{}={},", k.as_ref(), base64::encode(v.as_ref())));
});

// since we added a comma to the last entry, we will strip it to the exported header (this
// is safe since we know that comma is 1 byte in UTF8):
request.headers_mut().append(
HEADER,
http::header::HeaderValue::from_str(&s[..s.len() - 1])?,
);
let s = self
.0
.iter()
.map(|(k, v)| format!("{}={}", k.as_ref(), base64::encode(v.as_ref())))
.collect::<Vec<_>>()
.join(",");

request
.headers_mut()
.append(HEADER, http::header::HeaderValue::from_str(&s)?);

Ok(())
}
Expand Down

0 comments on commit 62b7c76

Please sign in to comment.