Consider following situation,
- In collection run (chaining requests), I want to run two requests sequentially.
- First request receives image blob as a response
- Second request need to use first request’s response (image blob) as form-data’s input as a file
- In separate (detached) tests, it work perfectly while I download first request’s response as image file and then use that local image as second request’s form-data file field.
- Now I want to automate this using Pre-request Script or Tests script
What I did so far,
- In the first request’s Tests I used following javascript code to save image response as variable named
imageData
let outputImage = pm.response.dataURI();
pm.variables.set('imageData', outputImage);
- In second request I set up input form-data like so,
but when I run collection run
, second request always fails…
In detached situation, I usually use like following and works well.
So question is how do I send (link) first request’s output image to second request’s input form-data?