postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.88k stars 1.17k forks source link

Newman reporter request object does not contain content type #2935

Open vbisbest opened 2 years ago

vbisbest commented 2 years ago
  1. Newman Version (can be found via newman -v): 5.3.1
  2. OS details (type, version, and architecture): Mac
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: Unsure
  5. Expected behaviour: 'request' should contain the Content-Type header

I am hooking the newman.on('request', (err, data)) call in my reporter. The Content-Type header missing. However when Newman runs (and Postment sends a request), the header is there (verified with a proxy). I am not sure how to determine the appropriate content-type with only the 'request' object. Is this a bug?

vbisbest commented 2 years ago

I should add, I also tried hooking the 'item' call and it has even less headers (usually 3 out of 12).

vbisbest commented 2 years ago

Here is an example. You can see the content-type in Postman (confirmed it works properly with newman as well).
Screen Shot 2022-02-23 at 4 53 31 AM

And here is the request object in my reporter, you can see the content-type header is not on the request function: Screen Shot 2022-02-23 at 5 01 07 AM