mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
3d2aef3979
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
38 lines
782 B
JavaScript
38 lines
782 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const expected = 'This is a unicode text: سلام';
|
|
let result = '';
|
|
|
|
const server = http.Server(function(req, res) {
|
|
req.setEncoding('utf8');
|
|
req.on('data', function(chunk) {
|
|
result += chunk;
|
|
}).on('end', function() {
|
|
server.close();
|
|
res.writeHead(200);
|
|
res.end('hello world\n');
|
|
});
|
|
|
|
});
|
|
|
|
server.listen(0, function() {
|
|
http.request({
|
|
port: this.address().port,
|
|
path: '/',
|
|
method: 'POST'
|
|
}, function(res) {
|
|
console.log(res.statusCode);
|
|
res.resume();
|
|
}).on('error', function(e) {
|
|
console.log(e.message);
|
|
process.exit(1);
|
|
}).end(expected);
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.strictEqual(expected, result);
|
|
});
|