Hi y’all
I have this in a post-response of a request:
const metadata = pm.response.json()[0].metadata; // either `null` or a string
pm.collectionVariables.set('metadata', metadata)
I use this variable to conditionally skip the next request; I have this in its pre-request script:
const metadata = pm.collectionVariables.get('metadata');
if (metadata === null) {
console.warn('WARN: /seatmap execution skipped: metadata was null')
pm.execution.skipRequest();
}
this works like a charm in the Postman app (windows 11), but when I tried the same collection with Newman, the second request was being executed.
After a little digging, I discovered that in the Postman app, the metadata
variable was saved and then recovered as a null
object, but in Newman (and Postman CLI) it was either saved or recovered as a "null"
string!
I resolved this issue by comparing metadata
with "null"
instead, so it’s not a problem for me anymore, but it seems like a bug, so I wanted to report it.