postmanpostman-flows

How to display a generated image in postman flow?


I have a simple yet tricky question about postman flow. How to display a generated image in the output block ?

When I run the request that create the image in classique mode my image is correctly rendered in the response body generated Qr code

But when I call the same request in flow, the image is not displayed postamn flow with image While a the link of an image is displaying the image correctly.

The endpoint that return the image is flagued with the good return type

@GetMapping(value = "/generateQR/{id}", produces = MediaType.IMAGE_PNG_VALUE)
    @PreAuthorize("hasAnyAuthority('ROLE_KAMINOAIN')")
    public @ResponseBody byte[] generateQRCode(@PathVariable("id") Long id) throws Exception {
        Clone clone = getOne(id);
        return barCodeService.generateQRCodeImage(clone.toString());
    }

I know that flow is a feature still in developement, so maybe it's not yet possible. But if anybody know how to render the image, it'will help.


Solution

  • So after some time I have found some work around

    Now my service don't send a byte array but a base64 encoded string that represent it

    @GetMapping(value = "/generateQR/{id}")
        @PreAuthorize("hasAnyAuthority('ROLE_KAMINOAIN')")
        public @ResponseBody String generateQRCode(@PathVariable("id") Long id) throws Exception {
            Clone clone = getOne(id);
            var qrcode = barCodeService.generateQRCodeImage(clone.toString());
            return Base64.getEncoder().encodeToString(qrcode);
        }
    

    Then in postman flow, in place of displaying the image just after getting it, I added a template bloc enter image description here

    and after this bloc I can render my image in a comment bloc enter image description here