Documentation says we can't do this. So as the title says, is there a workaround to make this possible?


You can use the setBodyAsBlob(Blob someBlob) method on HttpRequest to send a raw blob in an HTTP request. If you need to send a mime multi-part request, then that's harder as there's no good way to glue together the string mime part headers and the binary data (you can at this point, base64 encode the payload to work around that).


For servers that accept a Transfer-Encoding header, you can set the appropriate request header and send the data as Base64-encoded. Not all servers support this mode, however. It is also possible to send it as a multipart form message and set the Content-Transfer-Encoding header appropriately for servers that accept multipart form data with base64 encoding. If the server does not accept base64 encoding, then you cannot submit binary data to the server. This is because strings are native Unicode strings, and binary data doesn't play well with Unicode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.