Skip to content

Instantly share code, notes, and snippets.

View leozc's full-sized avatar

Leo Liang leozc

View GitHub Profile
@leozc
leozc / HttpSleeper.js
Last active July 23, 2018 20:15
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);