How to send query string parameters using supertest?

Although supertest is not that well documented, you can have a look into the tests/supertest.js.

There you have a test suite only for the query strings.

Something like:

request(app)
  .get("https://stackoverflow.com/")
  .query({ val: 'Test1' })
  .expect(200, function(err, res) {
    res.text.should.be.equal('Test1');
    done();
  });

Therefore:

.query({
  key1: value1,
  ...
  keyN: valueN
})

should work.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)