Sending raw binary body from pre-scripting variable


I am trying to send encrypted JSON using CryptoJS, but I cannot find out how to send raw binary with content-type like “application/octet-stream”.

In the request script, I prepare the JSON data, then I encrypt it using CryptoJS, and finally I should post the encrypted raw binary data as the body of the request.

In the body tab, I cannot use “Binary” as it expect a file, and using Raw→Text will encode the raw binary which I dont want.

How to proceed in that case ?


Hello pmaillet,

you found a solution to this?

This seems to be a duplicate of this older thread - also with no solution:

I have the same questions as well:
How can we update the request body before sending via pre-script to (AES-encrypted) binary data?
It should be sent as “application/octet-stream” content-type, so no base64 encoding needed.


Hi Andreas,

Nope, I tried many things but it seems that there is no solution for sending raw binary with Postman, everything I tried finished with string encoded data even when changing content-type.
I gave up as I also found multiples un answered threads with similar issue.

I think application/octet-stream is the correct content-type, but Postman doesn’t handle “raw binary” properly.
If you can, use base64 as it is ASCII, which would be correctly handled by Postman.


Thanks for your reply, Paul, that’s much appreciated!

Feels really strange to me this is not working, hope this gets fixed in the future - looks like more people are searching for this as there are multiple issues around for this topic like you write, too.

I don’t think it’s a good idea to increase data size by 30 % (and use base64 encoding) just because an API test tool like Postman does not properly support binary data.

I’ve also created a bug report in the Postman GitHub issue tracker about this:

In case still interesting for you, maybe you would like to add your use case there as well.

Best regards and thanks again for your reply