Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
connect-pause
Advanced tools
Weekly downloads
Readme
Connect/Express middleware to simulate latency for debugging
npm install connect-pause
Pause all Connect requests:
var connect = require('connect'),
pause = require('connect-pause');
Connect.createServer(
pause(1000),
function(req, res, next){
res.writeHead(200, {'Content-Type':'text/plain'});
res.end('Waited 1 second');
}
).listen(8080);
Pause all Express requests:
var express = require('express'),
pause = require('connect-pause');
var app = express();
app.use(pause(1000));
app.get('/', function(req, res){
res.send('Waited 1 second');
});
app.listen(3000);
Pause a single Express endpoint:
var express = require('express'),
pause = require('connect-pause');
var app = express();
app.get('/', pause(1000), function(req, res){
res.send('Waited 1 second');
});
app.listen(3000);
Pass an error to be returned after the delay:
var express = require('express'),
pause = require('connect-pause');
var app = express();
app.get('/', pause(1000, new Error('Send 500')), function(req, res){
res.send('Waited 1 second');
});
app.listen(3000);
This middleware is meant to be used while developing and in need to simulate latency for certain requests or all.
(The MIT License)
Copyright (c) 2013 Ariel Flesler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Connect/Express middleware to simulate latency for debugging
The npm package connect-pause receives a total of 230,654 weekly downloads. As such, connect-pause popularity was classified as popular.
We found that connect-pause demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.