Newman doesn't accept environment variable

Hello everyone!

I hoped I didn’t need to create a new topic here, but I think I have to.

    "name": "TestDiag",
    "gtin": "{{randomNumber}}",
    "description": "TestDiag",
    "productTypes": [1, 1],
    "diagnostics": [{{envDiag}}]

This is the body I send and when I try to send it with Postman, everything works fine. As soon as I use newman and send exactly the same, I get an HTTP415… can someone help me with that?

Generating the variable is done by:
pm.environment.set("envDiag", "3")

Same if I try with:
pm.environment.set("envDiag", 3)

I’m really hopeless… need help! :frowning:

Thanks in advance!!


Ok, I have no idea why, but I changed “pm.environment.set” to “pm.collectionVariables.set” and now it works. Seems like newman had problems getting that variable of the environment file.