Dynamic variables for images

Hi,

I have tried to use dynamic variables for images as stated in documentation Use dynamic variables to return randomly generated data | Postman Learning Center

I have used console to see the output:

console.log(pm.variables.replaceIn('{{$randomAvatarImage}}'));
console.log(pm.variables.replaceIn('{{$randomPeopleImage}}'));
console.log(pm.variables.replaceIn('{{$randomAbstractImage}}'));
console.log(pm.variables.replaceIn('{{$randomAnimalsImage}}'));
console.log(pm.variables.replaceIn('{{$randomBusinessImage}}'));
console.log(pm.variables.replaceIn('{{$randomFoodImage}}'));
console.log(pm.variables.replaceIn('{{$randomSportsImage}}'));
console.log(pm.variables.replaceIn('{{$randomTransportImage}}'));

The output does not contain any valid image URL. Examples:
β€˜https://cdn.fakercloud.com/avatars/buleswapnil_128.jpg’
β€˜http://placeimg.com/640/480/people’
β€˜http://placeimg.com/640/480/abstract’
β€˜http://placeimg.com/640/480/animals’
β€˜http://placeimg.com/640/480/business’
β€˜http://placeimg.com/640/480/food’
β€˜http://placeimg.com/640/480/sports’
β€˜http://placeimg.com/640/480/transport’

  • Potentially unsafe URL in the first variable, that is blocked by Chrome.
  • Placeimg.com is deprecated since July 2023.

Is it an oversight? Or the aim of these variables is just to generate any URL without ensuring there is really an image?

Thank you!

Hi @payload-participan16. Welcome to the Postman Community!

These dynamic variables should ideally return images that you can make use of within your testing workflows, so this isn’t an expected behaviour. Please, let me check in internally with the team to see what could possibly be wrong.

1 Like