@gpub1 my bad, I should have provided more info on what you should be looking at.
when you run the collection using newman
with verbose
switch, you should see the headers being output
newman run --verbose COLLECTION-NAME.json
The output should show you the header’s being sent:
┌
│ [
│ { key: 'Content-Type', value: 'application/json', system: true },
│ { key: 'User-Agent', value: 'PostmanRuntime/7.26.0', system: true },
│ { key: 'Accept', value: '*/*', system: true },
│ { key: 'Cache-Control', value: 'no-cache', system: true },
│ { key: 'Postman-Token', value: '587a5db2-XXX-XXX-XXXX-XXXXXXXXXX', system: true },
│ { key: 'Host', value: 'postman-echo.com', system: true },
│ { key: 'Accept-Encoding', value: 'gzip, deflate, br', system: true },
│ { key: 'Connection', value: 'keep-alive', system: true },
│ { key: 'Content-Length', value: 92, system: true }
│ ]
└
In the Postman app, since the request is working fine - you won’t see any errors - but if you expand the request, you should see the headers being sent:
Things to compare between newman and Postman app
- Check that similar headers are being sent and that the header values are similar
– Especially the Content-Type
header is what you should be looking at
– You may temporarily want to comment out the test-script for newman run, so that the request completes and you can check the headers (if not being shown already)
- Also check to make sure that any POST payload matches between newman and Postman app
– for this you can use console.log
to output the payload you are sending
I have a strong hunch it’s the Content-Type
header in the request that may be causing the issue here.