GT2/GT2-Android/node_modules/superagent/lib/node/parsers/urlencoded.js

23 lines
333 B
JavaScript

'use strict';
/**
* Module dependencies.
*/
const qs = require('qs');
module.exports = function(res, fn){
res.text = '';
res.setEncoding('ascii');
res.on('data', chunk => {
res.text += chunk;
});
res.on('end', () => {
try {
fn(null, qs.parse(res.text));
} catch (err) {
fn(err);
}
});
};