summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-invalid-path-chars.js
blob: 56755faa8c835dc51b755db0ec116bc95f6caff2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

require('../common');
const assert = require('assert');
const http = require('http');

const theExperimentallyDeterminedNumber = 39;

for (let i = 0; i <= theExperimentallyDeterminedNumber; i++) {
  const prefix = 'a'.repeat(i);
  for (let i = 0; i <= 32; i++) {
    assert.throws(() => {
      http.request({ path: prefix + String.fromCodePoint(i) }, assert.fail);
    }, {
      code: 'ERR_UNESCAPED_CHARACTERS',
      name: 'TypeError',
      message: 'Request path contains unescaped characters'
    });
  }
}