node/test/known_issues/test-http-path-contains-unicode.js
Antoine du Hamel 6d92cc736d
test: add trailing commas in test/known_issues
PR-URL: https://github.com/nodejs/node/pull/46408
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2023-02-01 10:46:55 +01:00

37 lines
888 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(expected, '/caf\u{e9}\u{1f436}');
const server = http.createServer(common.mustCall(function(req, res) {
assert.strictEqual(req.url, expected);
req.on('data', common.mustCall()).on('end', common.mustCall(function() {
server.close();
res.writeHead(200);
res.end('hello world\n');
}));
}));
server.listen(0, () => {
http.request({
port: server.address().port,
path: expected,
method: 'GET',
}, common.mustCall(function(res) {
res.resume();
})).on('error', function(e) {
console.log(e.message);
process.exit(1);
}).end();
});