This commit is contained in:
maxswa
2018-05-15 16:09:29 -04:00
parent 8cdf1fb19d
commit 5986f5feb6
233 changed files with 42104 additions and 2 deletions

12
node_modules/superagent/lib/node/parsers/image.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
module.exports = (res, fn) => {
const data = []; // Binary data needs binary storage
res.on('data', chunk => {
data.push(chunk);
});
res.on('end', () => {
fn(null, Buffer.concat(data));
});
};

10
node_modules/superagent/lib/node/parsers/index.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict';
exports['application/x-www-form-urlencoded'] = require('./urlencoded');
exports['application/json'] = require('./json');
exports.text = require('./text');
const binary = require('./image');
exports['application/octet-stream'] = binary;
exports['application/pdf'] = binary;
exports.image = binary;

22
node_modules/superagent/lib/node/parsers/json.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
module.exports = function parseJSON(res, fn){
res.text = '';
res.setEncoding('utf8');
res.on('data', chunk => {
res.text += chunk;
});
res.on('end', () => {
try {
var body = res.text && JSON.parse(res.text);
} catch (e) {
var err = e;
// issue #675: return the raw response if the response parsing fails
err.rawResponse = res.text || null;
// issue #876: return the http status code if the response parsing fails
err.statusCode = res.statusCode;
} finally {
fn(err, body);
}
});
};

10
node_modules/superagent/lib/node/parsers/text.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = function(res, fn){
res.text = '';
res.setEncoding('utf8');
res.on('data', chunk => {
res.text += chunk;
});
res.on('end', fn);
};

22
node_modules/superagent/lib/node/parsers/urlencoded.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'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);
}
});
};