17 lines
349 B
JavaScript
17 lines
349 B
JavaScript
|
/**
|
||
|
* Serializes an object to a query params
|
||
|
*
|
||
|
* @param {Object} obj The params object
|
||
|
* @return {String} Serialized params
|
||
|
*/
|
||
|
exports.httpParamSerializer = function(obj) {
|
||
|
let query = '';
|
||
|
for (let param in obj) {
|
||
|
if (query != '')
|
||
|
query += '&';
|
||
|
query += `${param}=${obj[param]}`;
|
||
|
}
|
||
|
|
||
|
return query;
|
||
|
};
|