My question:
How do I GET an image file from one request, and use the image file returned in a subsequent request as binary?
How I found the problem:
AWS requires real files to be sent to the POST endpoint, not URLS, but handling a postman test dependency (real files) outside of postman is vastly less efficient for automation or sharing the tests among lots of devs.
I’ve already tried:
Targeting the image like so:
pm.globals.set(‘imageup’,pm.request.body.raw)
Seems to set the global correctly, but how do I recall that global var to send as a binary file in the subsequent request?
Old attempts:
I tried using the environment vars, but those seem to only take text/strings.
I tried this as a prerequest script:
const postRequest = {
url: ‘https://i.imgur.com/CDaaUwi.jpeg’,
method: ‘GET’,
};
pm.sendRequest(postRequest, (error, response) => {
console.log("request sent " + response.body)
pm.globals.set(‘imageup’,response.body)
});