0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-03 23:09:17 -05:00
verdaccio/test/functional/fixtures/plugins/middlewares.uplink.js

26 lines
570 B
JavaScript
Raw Normal View History

const nock = require('nock');
function Plugin(config) {
const self = Object.create(Plugin.prototype);
self._config = config;
return self;
}
Plugin.prototype.register_middlewares = function (app, auth, storage) {
app.get('/test-uplink-timeout-*', function (req, res, next) {
// https://github.com/nock/nock#readme
nock('http://localhost:55552')
.get(req.path)
// 31s is greater than the default 30s connection timeout
.socketDelay(50000)
// http-status 200 OK
.reply(200);
next();
});
};
module.exports = Plugin;