mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
678 B
30 lines
678 B
'use strict';
|
|
const assert = require('assert');
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
var start;
|
|
const server = http.createServer(common.mustCall(function(req, res) {
|
|
req.resume();
|
|
req.on('end', function() {
|
|
res.end('Success');
|
|
});
|
|
|
|
server.close();
|
|
}));
|
|
|
|
server.listen(common.PORT, 'localhost', common.mustCall(function() {
|
|
start = new Date();
|
|
const req = http.request({
|
|
'host': 'localhost',
|
|
'port': common.PORT,
|
|
'agent': false,
|
|
'method': 'PUT'
|
|
});
|
|
req.end('Test');
|
|
}));
|
|
|
|
process.on('exit', function() {
|
|
const end = new Date();
|
|
assert(end - start < 1000, 'Entire test should take less than one second');
|
|
});
|
|
|