postmanlabs / newman

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

GET tests only pass with { body: { mode: 'raw', raw: '{}' } } #2756

Closed snoblenet closed 2 years ago

snoblenet commented 3 years ago

Context:

Newman v5.2.3 Mac OS X 11.4 on Intel Core i7 Node v14.17.0

Expected behaviour / steps to reproduce / etc:

Add a request in Postman.app that hits a GET endpoint.

It's a GET request so it should have no body.

Run the request in Postman.app and confirm that it works as expected.

Copy the curl generated by Postman.app and confirm that it works as expected in your terminal.

Add a test to this request and confirm that it passes in Postman.app as expected.

Export the collection and attempt to run it with:

  newman.run({ collection, envVar, reporters: 'cli' }, async (error, summary) => {
    // stuff
  });

Confirm that the test fails in newman.

Add the following to the request in the exported collection:

"body": {
  "mode": "raw",
  "raw": "{}"
 },

Confirm that the test now passes in Newman.

In an attempt to find the exact cause I've followed collection as it is passed down through various utils.

I have confirmed that when the test fails, postman-request is never called but I have not been able to establish why.

snoblenet commented 3 years ago

Unbelievably, I even had to add a fake empty body like this to make Postman's own test pass in Newman.

codenirvana commented 3 years ago

@snoblenet I am not able to reproduce this issue locally, can you share a scaled-down collection which we can use to reproduce this issue?

Postman Echo's request you shared is also passing the tests:

Screenshot 2021-06-22 at 9 33 43 AM

DannyDainton commented 2 years ago

Closing due to inactivity.