salix/loopback/util/http.js

17 lines
349 B
JavaScript
Raw Permalink Normal View History

/**
* 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;
};