postmanlabs / newman

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

Newman Follows Redirects #261

Closed airios closed 8 years ago

airios commented 8 years ago

My API request returns a 302 along with a Location header. I'm running tests to verify this, but Newman is following the redirect. Is there a way to prevent this, so I can run these tests accordingly?

Disclaimer: It's entirely possible I missed something in the docs.

abhijitkane commented 8 years ago

@airios We'll add an option for this in the next release. For now, you can edit the Newman module. In your node_modules directory (wherever you're running Newman from), edit src/runners/RequestRunner.js After line 232, add RequestOptions.followRedirect = false;

airios commented 8 years ago

This works fine but for CI server purposes, it doesn't. :cry: I'll just modify our acceptance for now, and check on the next release.

chrisware commented 8 years ago

+1 for this feature. It would be great to be able to configure follow redirects in the options.

czardoz commented 8 years ago

This was fixed in https://github.com/postmanlabs/newman/commit/525349971b2061ddbb78cafa2650c3bbf4c042fc. You can now use the -R command line flag to avoid redirects.

Feel free to re-open this issue in case anything is amiss.

airios commented 8 years ago

Awesome thanks!

airios commented 8 years ago

Was this removed in recent releases? @abhijitkane @czardoz

czardoz commented 8 years ago

@airios, no, it wasn't removed. Are you having problems with this?

joelpurra commented 7 years ago

@airios, @czardoz: It does seem as if -R was removed, but --ignore-redirects works.

Guilherme-Sensedia commented 6 years ago

Please, i need help for a question about follow redirect url in newman.

I Have a request in postman working generate authentication code in header, but not generate authentication code in newman.