summaryrefslogtreecommitdiff
path: root/test/known_issues
diff options
context:
space:
mode:
authorDavid D Lowe <daviddlowe.flimm@gmail.com>2017-05-30 14:08:16 +0100
committerJames M Snell <jasnell@gmail.com>2017-06-01 20:20:49 -0700
commit592d7d2f2a153edabee8a60dbcc1c7c6fce45463 (patch)
tree88bc97d3c0b9f6f3a086ff5033f51e0969e96bc6 /test/known_issues
parenta9f798ebcc1bbef86cff3b0ba8cb3bc004602387 (diff)
downloadandroid-node-v8-592d7d2f2a153edabee8a60dbcc1c7c6fce45463.tar.gz
android-node-v8-592d7d2f2a153edabee8a60dbcc1c7c6fce45463.tar.bz2
android-node-v8-592d7d2f2a153edabee8a60dbcc1c7c6fce45463.zip
test: add known_test request with Unicode in the URL
This test currently fails. It illustrates that Unicode in the URL does not arrive intact to the server, there is silent data corruption along the way at some point. This test is for the issue https://github.com/nodejs/node/issues/13296. PR-URL: https://github.com/nodejs/node/pull/13297 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/known_issues')
-rw-r--r--test/known_issues/test-http-path-contains-unicode.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/known_issues/test-http-path-contains-unicode.js b/test/known_issues/test-http-path-contains-unicode.js
new file mode 100644
index 0000000000..8f90a0d57f
--- /dev/null
+++ b/test/known_issues/test-http-path-contains-unicode.js
@@ -0,0 +1,41 @@
+'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}',
+ 'Sanity check that string literal produced the expected string'
+);
+
+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();
+});