Hi, I recently upgraded from an earlier version of httpclient where I was able to construct multipart messages “by hand”. However, the recent refinements added to check the content type of my message now cause that approach to fail. (The presence of the “; boundary=…” in the content type string runs afoul of the syntax checking on the header.)
The messages that I’m trying to construct have nothing to do with forms. My requirements appear (to me) to be simple: I want to construct the multipart message, providing both text and binary bodies, with my own headers for each part. It seems that the MultipartEntityBuilder is the preferred mechanism for constructing multipart messages https://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/index.html But, AFAICT: 1. The convenience methods (addBinaryBody, addTextBody) provide no way to specify headers. 2. The ContentBody objects don’t provide any way to specify headers. 3. And, while the FormBodyPartBuilder does (in the addField method, which seems slightly oddly named for this purpose), it also adds a filename header because its form related. Have I overlooked something obvious? Be seeing you, norm -- Norman Walsh <[email protected]> | There has never been a perfect http://nwalsh.com/ | government, because men have passions; | and if they did not have passions, | there would be no need for | government.--Voltaire
signature.asc
Description: PGP signature
