in core/src/raw/http_util/multipart.rs [853:950]
fn test_multipart_mixed_azblob_batch_delete() -> Result<()> {
let multipart = Multipart::new()
.with_boundary("batch_357de4f7-6d0b-4e02-8cd2-6361411a9525")
.part(
MixedPart::new("/container0/blob0")
.method(Method::DELETE)
.part_header("content-id".parse().unwrap(), "0".parse().unwrap())
.header(
"x-ms-date".parse().unwrap(),
"Thu, 14 Jun 2018 16:46:54 GMT".parse().unwrap(),
)
.header(
"authorization".parse().unwrap(),
"SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE="
.parse()
.unwrap(),
)
.header("content-length".parse().unwrap(), "0".parse().unwrap()),
)
.part(
MixedPart::new("/container1/blob1")
.method(Method::DELETE)
.part_header("content-id".parse().unwrap(), "1".parse().unwrap())
.header(
"x-ms-date".parse().unwrap(),
"Thu, 14 Jun 2018 16:46:54 GMT".parse().unwrap(),
)
.header(
"authorization".parse().unwrap(),
"SharedKey account:IvCoYDQ+0VcaA/hKFjUmQmIxXv2RT3XwwTsOTHL39HI="
.parse()
.unwrap(),
)
.header("content-length".parse().unwrap(), "0".parse().unwrap()),
)
.part(
MixedPart::new("/container2/blob2")
.method(Method::DELETE)
.part_header("content-id".parse().unwrap(), "2".parse().unwrap())
.header(
"x-ms-date".parse().unwrap(),
"Thu, 14 Jun 2018 16:46:54 GMT".parse().unwrap(),
)
.header(
"authorization".parse().unwrap(),
"SharedKey account:S37N2JTjcmOQVLHLbDmp2johz+KpTJvKhbVc4M7+UqI="
.parse()
.unwrap(),
)
.header("content-length".parse().unwrap(), "0".parse().unwrap()),
);
let bs = multipart.build();
let expected = r#"--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 0
DELETE /container0/blob0 HTTP/1.1
x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
authorization: SharedKey account:G4jjBXA7LI/RnWKIOQ8i9xH4p76pAQ+4Fs4R1VxasaE=
content-length: 0
--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1
DELETE /container1/blob1 HTTP/1.1
x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
authorization: SharedKey account:IvCoYDQ+0VcaA/hKFjUmQmIxXv2RT3XwwTsOTHL39HI=
content-length: 0
--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2
DELETE /container2/blob2 HTTP/1.1
x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
authorization: SharedKey account:S37N2JTjcmOQVLHLbDmp2johz+KpTJvKhbVc4M7+UqI=
content-length: 0
--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--
"#;
assert_eq!(
expected,
// Rust can't represent `\r` in a string literal, so we
// replace `\r\n` with `\n` for comparison
String::from_utf8(bs.to_bytes().to_vec())
.unwrap()
.replace("\r\n", "\n")
);
Ok(())
}