mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f5d9169ded
assert.strictEqual message argument removed to replace with default assert message to show the expected vs actual values PR-URL: https://github.com/nodejs/node/pull/18259 Refs: https://github.com/nodejs/node/issues/13296 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
38 lines
906 B
JavaScript
38 lines
906 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// This test ensures that Unicode characters in the URL get handled correctly
|
|
// by `http`
|
|
// Refs: https://github.com/nodejs/node/issues/13296
|
|
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const expected = '/café🐶';
|
|
|
|
assert.strictEqual('/caf\u{e9}\u{1f436}', expected);
|
|
|
|
const server = http.createServer(common.mustCall(function(req, res) {
|
|
assert.strictEqual(req.url, expected);
|
|
req.on('data', common.mustCall(function() {
|
|
})).on('end', common.mustCall(function() {
|
|
server.close();
|
|
res.writeHead(200);
|
|
res.end('hello world\n');
|
|
}));
|
|
|
|
}));
|
|
|
|
server.listen(0, function() {
|
|
http.request({
|
|
port: this.address().port,
|
|
path: expected,
|
|
method: 'GET'
|
|
}, common.mustCall(function(res) {
|
|
res.resume();
|
|
})).on('error', function(e) {
|
|
console.log(e.message);
|
|
process.exit(1);
|
|
}).end();
|
|
});
|