Hi there. I think I found a bug so I wanted to post here to verify with someone else that it is. I spent 2 hours figuring this out. I am using Newman 3.8.0.
Scenario:
1) Create collection TESTING (name doesn't matter; just adding this step for brevity)
2) Create test against GET https://www.google.com and put it in TESTING collection
3) Add a header but do not put a key or value in the header (empty strings for both)
4) Run test in postman (it works!)
5) Run it in Newman (newman breaks).
Thanks in advance.
Could you also share:
node -v) (and Postman App) versionnewman run ...@DotNetRockStar To add to the previous message, I was able to get empty headers working with the following collection on Node v6.11.1:
{
"info": {
"name": "empty-header-test",
"_postman_id": "1d49dd6f-e3a5-5178-28e5-65f16776eca1",
"description": "https://github.com/postmanlabs/newman/issues/1154",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Echo GET",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"console.log('Request headers:');",
"console.log(request.headers);",
"tests['Empty header `x-custom-header` works'] = request.headers['x-custom-header'] === '';"
]
}
}
],
"request": {
"url": "https://postman-echo.com/get",
"method": "GET",
"header": [
{
"key": "x-custom-header",
"value": ""
}
]
}
}
]
}
I just checked and I can reproduce the issue for sure. Works in Postman tool but not Newman.
Make sure your key and value are both empty strings, not just the value.
@DotNetRockStar Thanks, I was able to reproduce this bug.
@DotNetRockStar This has been fixed in Newman v3.8.1.