rest-assured
rest-assured copied to clipboard
remove deprecated Content-Transfer-Encoding from multipart post headers
motivation:
This PR fixes a problem I stumbled upon: rest-assured requests are rejected by receiver because of invalid header in multipart post.
According to https://datatracker.ietf.org/doc/html/rfc7578#section-4.7 senders SHOULD NOT generate any parts with a Content-Transfer-Encoding header field.
sources:
- SO issue related directly to rest-assured: https://stackoverflow.com/questions/72868970/javarestassured-remove-content-transfer-encoding-binary-from-multipart-request
- another probable manifestation of the root cause coming from (possibly incorrect usage of) the underlying apache library elsewhere: https://stackoverflow.com/questions/33023370/setting-the-content-transfer-encoding-of-upload-file-in-multi-part-http-request
compare/contrast:
cURL 7.68.0 for -F [email protected] sends e.g.:
Content-Disposition: form-data; name="attachments"; filename="attachment.txt"
Content-Type: text/plain
test
rest-assured 5.4.0 for .multiPart("attachments", new File("attachment.txt"), "text/plain") without fix sends e.g.:
Content-Disposition: form-data; name="attachments"; filename="attachment.txt"
Content-Type: text/plain
Content-Transfer-Encoding: binary
test
rest-assured 5.4.0 with this fix sends e.g.:
Content-Disposition: form-data; name="attachments"; filename="attachment.txt"
Content-Type: text/plain
test
@johanhaleby any suggestions how to steer the fix to the next release? :)
Thank you very much.