Skip to content

Instantly share code, notes, and snippets.

@yigit-darcin
Forked from leozc/HttpSleeper.js
Created October 19, 2015 10:52
Show Gist options
  • Save yigit-darcin/e5ae30cd240e2c4c029b to your computer and use it in GitHub Desktop.
Save yigit-darcin/e5ae30cd240e2c4c029b to your computer and use it in GitHub Desktop.
Node.js HTTP sleep server Simulate HTTP Timeout error
var http = require('http');
var sleep = require('sleep');
var timeout = 100000; //sleep 100 seconds
http.createServer(function (req, res) {
setTimeout((function() {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end("Hello I am awake");
}), timeout);
}).listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment