UNPKG

lx-scan

Version:

License eXtension to find 5-tuples of all installed packages: name, version, project home page, license (e. g. Apache v2, BSD) and required notice. It includes a GUI to edit information for each package and to enter information if necessary.

27 lines (23 loc) 870 B
var request = module.exports.request = require("request"); var default_request = module.exports.default_request = function(license_object, outer_callback) { return function(uri,callback) { request.get( { uri: uri, jar: true, // workaround for https://github.com/mikeal/request/issues/311 // per https://github.com/mgarcs/scraperjs/commit/7609afec722c9af425d700744c4f56492528b6ec headers: { "User-Agent": "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410." } }, function (error,res,body) { if(res.statusCode === 200 && !error) { callback(error,res,body); } else { // This gives us an opportunity to do some error checking in the // event that something goes wrong with the HTTP request outer_callback(null,license_object); } } ); }; };