I mentioned the file type as .jpg just for the sake of simplicity. The file type that I am dealing here with is “dcm”.
The service that I am trying to test requires a dcm file to be converted to binary data first, then this binary data needs to be part of the POST request body. I’ll try to attach some images for reference:
If I send this request with the appropriate authorization and content-type header, it will be posted to the service without any problem. But I want to automate this and I want it to be the part of my pre request script. This is as far as I’ve come:
Now, I want to know how can I specify a binary data in body tag? Is that even possible using pre request script?
It doesn’t look like it’s meant to go in the body tags.
I don’t know if you can change the folder\filename to pick it up from the Postman working directory found in Settings\General (but this won’t really help if you want to pick up the file from a central location).
Which means you are back to Newman and node.js (so you can include the fs library).
Here are some links and examples if you have to go that route.