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 adds an equals "=" character to a query parameter that has no value #1398

Closed betson-nuovo closed 6 years ago

betson-nuovo commented 6 years ago

Configuring a URL of the following form in a postman collection (tested with 5.5.0 and 5.6.0-canary01): https://www.google.com?equals will result in newman making the request with an added equals "=" character: GET https://www.google.com?equals=

In my use case, we have several endpoints which will fail with this added equals character.

  1. Newman Version (can be found via newman -v): 3.9.3
  2. OS details (type, version, and architecture): OSX 10.12.6
  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: Only tested with this version
  5. Expected behaviour: Expect to make the call without the added "=" character
  6. Command / script used to run Newman: newman run Basic-Equals-Repro.postman_collection.json -r cli,json --reporter-json-export equals-sign-report.json
  7. Sample collection, and auxiliary files (minus the sensitive details): EqualsTest.zip
shamasis commented 6 years ago

This does not happen in Postman Native App? We did put a lot of safeguards against this. @kunagpal can you have a look?

betson-nuovo commented 6 years ago

Tested with the postman app itself and I am seeing my endpoints fail, whereas a curl succeeds. Tested with Postman 5.5.0, 5.5.2, 5.6.0-canary01

Carmot commented 6 years ago

cURL code auto generated by Postman v5.5.2 for: GET https://www.google.com?equals

curl -X GET \ 'https://www.google.com?equals='

kunagpal commented 6 years ago

@betson-nuovo @Carmot Could you also share the collections that are behaving as described above?

betson-nuovo commented 6 years ago

@kunagpal sample collection already attached to the initial post

kunagpal commented 6 years ago

@betson-nuovo Thanks, I was able to reproduce this issue with the collection you shared. 😄

I'll update this thread when a fix is out. A temporary workaround is to replace all empty string values for the query parameters with explicit null.

betson-nuovo commented 6 years ago

Thanks @kunagpal. Confirmed that editing the json collection and setting "value": null makes the correct call when executing in newman.

TAkbay commented 6 years ago

@kunagpal When will this issue be in progress? We have very large collections and it would be nice if this could be fixed.

matiasmatteucci commented 6 years ago

We need this to be fixed too, in our case it adds an "=" after every environment variable that acts as a query parameter:

{{location}} = lat=4.727233219862&lng=-74.049106476107

gets sent as

lat=4.727233219862&lng=-74.049106476107=

EDIT: adding the "?" in the variable seems to fix the issue, although it's an ugly workaround which forces us to always have the same order of parameters.

JebediahSpringfield commented 6 years ago

Just to put some pressure on the issue.

My problem happens in a very simple case Request: GET http://10.2.1.1/api?{{myVar}} Pre-request Script: pm.globals.set("myVar", "param=paramValue");

Result: GET http://10.2.1.1/api?param=paramValue=

I'n my case the problem goes away if I remove the "=" from the value of the var: Request: GET http://10.2.1.1/api?param={{myVar}} Pre-request Script: pm.globals.set("myVar", "paramValue");

Result: GET http://10.2.1.1/api?param=paramValue

kamalaknn commented 6 years ago

Hi, we've pushed a fix for this in our latest Canary apps. You can find the link to download the app here.

Collections exported from this app will NOT add a trailing = when run with newman.

bartdkmediahuis commented 6 years ago

@kamalaknn : Any idea when this will be deployed to the stable newman version ? We do have a lot of tests failing on this bug. Switching to canary is not an option at the moment.

shadone commented 6 years ago

Hi there,

I just hit the same issue - Postman app work correctly and does not append trailing= sign but the newman cli does. Is there a chance this will be fixed?

kunagpal commented 6 years ago

@shadone Which Newman version are you on?