Passing two parameters to chai-http with same name

Passing two parameters to chai-http with same name
0.0 0

#1

Hi there.

I can’t work out how to send two parameters to a chai test that have the same name. It only seems to recognise the second parameter.

e.g.

chai.request(server)
        .get('/api/widgets')
        .query({wtype 'nits',wtype:'gnats',insect:true})
        .end(function(err, res){
          var insects = res.body
          console.log(insects)

Any ideas?


#2

Found the answer:
While .query may not be able to handle two parameters of the same name, you can just remove this clause and put the whole query in the .get section like this:

chai.request(server)
        .get('/api/widgets/?wtype=nits&wtype=gnats&insect=true')
        .end(function(err, res){
          var insects = res.body
          console.log(insects)}