The following Node.js code:
var request = require(\'request\');
var getLibs = function() {
var options = { packages: [\'example1\', \'example2\', \'example3
This problem can be solved using Request library itself. Request internally uses qs.stringify. You can pass q option to request which it will use to parse array params.
You don't need to append to url which leaves reader in question why that would have been done.
Reference: https://github.com/request/request#requestoptions-callback
const options = { method: 'GET', uri: 'http://localhost:3000/package', qs: { packages: ['example1', 'example2', 'example3'], os: 'linux', pack_type: 'npm' }, qsStringifyOptions: { arrayFormat: 'repeat' // You could use one of indices|brackets|repeat }, json: true };