I want to store a file as a base64-encoded variable in the collection.
I then want to use atob
to convert it into a binary array and send it using form-data content type.
I’ve tried using raw tab in the postman and hand-coded the body using a variable:
------WebKitFormBoundarySWVM8J7MzhwVMYiR
Content-Disposition: form-data; name=“file”; filename=“wells.xlsx”
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
{{Test2x2AsntDefBinary}}
------WebKitFormBoundarySWVM8J7MzhwVMYiR–
But the binary values in the variable get encoded differently (text encoding issue maybe?)
So I try to send:
pm.variables.set(‘Test2x2AsntDefBinary’, atob(btoa(“\xFF00”)));
but the following actually being sent:
195 191 48 48
Related to this. How can I see the actual request sent?