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

Newman post x-www-form-urlencoded request return undefined #1511

Closed michelics closed 6 years ago

michelics commented 6 years ago

When I run the command newman return: undefined.

But works using Postman Runner

image

image

image

image

prakharjoshi commented 6 years ago

Hi @michelics I have couple of doubts here, while sending request through Postman you are setting content-type in request body and disabled the content-type header. Can you please enabled the header and try to run it with Newman again? If it doesn't work do let us know and also share the sample collection and environment that you are using for Newman run.

michelics commented 6 years ago

Newman command: newman run test.postman_collection.json --folder xyz -e hti_env.postman_environment.json -g globals.postman_globals.json -r html,cli --reporter-html-template template-default.hbs --reporter-html-export reporter.html

michelics commented 6 years ago

I tried with content-type enabled and disabled doesn't work. Is it necessary a differnt configuration to run by newman with success? Because ran by Runner with success, but by newman fails. I think that is related x-www-form-urlencoded

kunagpal commented 6 years ago

@michelics Apologies for the delay, could you share the following details?

  1. The exported collection (so that I may verify that the Content-Type header is present). Feel free to remove any sensitive details.
  2. The result of adding console.log(pm.request.headers); to your request's test script.
lexon commented 6 years ago

For better debugging, run newman with: NODE_DEBUG=http newman run ...

kunagpal commented 6 years ago

@michelics Closing issue due to inactivity, feel free to revert if you have any other questions 😄