Newman: BUG: Empty header works in postman not in newman

Created on 31 Jul 2017  路  5Comments  路  Source: postmanlabs/newman

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.

  • Jerrod
bug in progress runtime

All 5 comments

Could you also share:

  1. The Node (node -v) (and Postman App) version
  2. The reduced collection that causes this.
  3. Error messages that come up in the newman 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.

  1. Node version is v7.10.0
  2. Attached
    google test.postman_collection.zip
  3. What is the best way to get the error message from newman? The console itself didn't throw an error, I just checked the error code and reports to find out it failed.

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.

Was this page helpful?
0 / 5 - 0 ratings