Created
August 7, 2015 10:48
-
-
Save Jabher/22a1ee55c6409a72eb32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Server} from 'http'; | |
const server = new Server(); | |
server.listen(8080); | |
server.on('request', async function (req, res) { | |
req.pause(); | |
res.statusCode = 200; | |
req.on('end', () => res.end('OK')); | |
const length = message.headers['content-length']; | |
const chunk = length / 100; | |
for (let i = 0; i < length; i++) { | |
await new Promise(res => setTimeout(res, 250)); | |
req.read(chunk); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment