mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

PR-URL: https://github.com/nodejs/node/pull/14423 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
26 lines
619 B
JavaScript
26 lines
619 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const expectedError = common.expectsError({
|
|
code: 'ERR_UNESCAPED_CHARACTERS',
|
|
type: TypeError,
|
|
message: 'Request path contains unescaped characters'
|
|
}, 1320);
|
|
const theExperimentallyDeterminedNumber = 39;
|
|
|
|
function fail(path) {
|
|
assert.throws(() => {
|
|
http.request({ path }, assert.fail);
|
|
}, expectedError);
|
|
}
|
|
|
|
for (let i = 0; i <= theExperimentallyDeterminedNumber; i++) {
|
|
const prefix = 'a'.repeat(i);
|
|
for (let i = 0; i <= 32; i++) {
|
|
fail(prefix + String.fromCodePoint(i));
|
|
}
|
|
}
|