postmanlabs / newman

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

POST calls with form-data fields does not work with Newman, works with collection Runner #114

Closed mverma-va closed 10 years ago

mverma-va commented 10 years ago

Noticed that POST calls with form-data fields does not work with Newman(command line), but the same works with collection Runner. I have confirmed the behavior, if I move the form-fields to the URL-params section, it works with Newman(command line).

screen shot 2014-06-23 at 3 46 18 pm

abhijitkane commented 10 years ago

I created a POST request in Postman which had URL parameters and form-data. The response was correct. After saving the collection, and running in Newman, all tests were still running. For you, are the tests failing, or is it something else?

mverma-va commented 10 years ago

Yes, my tests are failing only when I run them through Newman, works with collection runner. What I am doing with my TEST scripts is that I am storing some id's from response body of previous calls to env. var and using them in future calls(to make data dynamic, that could be the reason too) var retData = JSON.parse(responseBody); postman.setEnvironmentVariable("agid", retData.data.agid);

So after fetching this agid, I am using it in the delete call (as in earlier snapshot), so is that the reason. If you see the current attached snapshot, it works fine if I move the form-data to url params.

screen shot 2014-06-25 at 11 26 08 am

abhijitkane commented 10 years ago

Will have to look into this...thanks for pointing it out.

mverma-va commented 10 years ago

Also noticed with Newman, that this works fine in form-data when I hard coded the variable "agid" to some value, but failed when I used as env variable "{{agid}}". So it seems POST calls are working with form-data, but it is just those env. variables not working in form-data.

abhijitkane commented 10 years ago

This has been fixed - we'll push a new release this week.

abhijitkane commented 10 years ago

We've pushed new release - 1.0.7. Can you mark this as closed?

mverma-va commented 10 years ago

This is working fine now, thanks for the quick fix :)