[Rust Server] Improve RFC 13341 compliance for multipart/related (#19355)

* [Rust Server] Improve RFC 13341 compliance for multipart/related

* Update samples
This commit is contained in:
Richard Whitehouse 2024-08-15 10:04:59 +01:00 committed by GitHub
parent be09f8a868
commit 024bbb7784
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -30,7 +30,10 @@
{{#-last}}
// Write the body into a vec.
let mut body: Vec<u8> = vec![];
// RFC 13341 Section 7.2.1 suggests that the body should begin with a
// CRLF prior to the first boundary. The mime_multipart library doesn't
// do this, so we do it instead.
let mut body: Vec<u8> = vec![b'\r', b'\n'];
write_multipart(&mut body, &boundary, &body_parts)
.expect("Failed to write multipart body");
{{/-last}}

View File

@ -469,7 +469,10 @@ impl<S, C> Api<C> for Client<S, C> where
}
// Write the body into a vec.
let mut body: Vec<u8> = vec![];
// RFC 13341 Section 7.2.1 suggests that the body should begin with a
// CRLF prior to the first boundary. The mime_multipart library doesn't
// do this, so we do it instead.
let mut body: Vec<u8> = vec![b'\r', b'\n'];
write_multipart(&mut body, &boundary, &body_parts)
.expect("Failed to write multipart body");
@ -741,7 +744,10 @@ impl<S, C> Api<C> for Client<S, C> where
}
// Write the body into a vec.
let mut body: Vec<u8> = vec![];
// RFC 13341 Section 7.2.1 suggests that the body should begin with a
// CRLF prior to the first boundary. The mime_multipart library doesn't
// do this, so we do it instead.
let mut body: Vec<u8> = vec![b'\r', b'\n'];
write_multipart(&mut body, &boundary, &body_parts)
.expect("Failed to write multipart body");