supertest-prefix
Advanced tools
Comparing version 1.0.0 to 1.0.1
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', './supertest-prefix'], factory); | ||
define(['exports'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('./supertest-prefix')); | ||
factory(exports); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global.supertestPrefix); | ||
factory(mod.exports); | ||
global.index = mod.exports; | ||
} | ||
})(this, function (exports, _supertestPrefix) { | ||
})(this, function (exports) { | ||
'use strict'; | ||
@@ -20,14 +20,18 @@ | ||
}); | ||
Object.defineProperty(exports, 'supertestPrefix', { | ||
enumerable: true, | ||
get: function () { | ||
return _interopRequireDefault(_supertestPrefix).default; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
exports.default = function (prefix) { | ||
return function (req) { | ||
if (req.url[0] === '/') { | ||
req.url = prefix + req.url; | ||
return req; | ||
} | ||
var protocol = req.url.substring(0, req.url.indexOf('://') + 3); | ||
var path = req.url.substring(req.url.indexOf('://') + 3, req.url.length); | ||
var newPath = path.substring(0, path.indexOf('/')) + prefix + path.substring(path.indexOf('/'), path.length); | ||
req.url = protocol + newPath; | ||
return req; | ||
}; | ||
} | ||
}; | ||
}); |
{ | ||
"name": "supertest-prefix", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "An extension to supertest which adds prefix to the routes", | ||
@@ -5,0 +5,0 @@ "license": "WTFPL", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4847
9
48