How to use qs

Comprehensive qs code examples:

How to use qs.parse:

178
179
180
181
182
183
184
185
186
187
  };
  var res = request.post(buildUrl(path), {qs: qstring, timeout: 300});
  expect(res).to.be.an.instanceof(request.Response);
  var obj = JSON.parse(res.body);
  var urlObj = url.parse(obj.url);
  var query = qs.parse(urlObj.query);
  expect(query).to.eql(qstring);
},

testQuerystringWithUseQuerystring: function () {

How to use qs.stringify:

166
167
168
169
170
171
172
173
174
175
try {
    const res = await axios({
        url: validate_url,
        method: "POST",
        timeout: GeetestLib.HTTP_TIMEOUT_DEFAULT,
        data: qs.stringify(params),
        headers: { "Content-Type": "application/x-www-form-urlencoded" }
    }).catch(err => {
        // console.log(err)
    });