xref: /third_party/node/test/parallel/test-http-invalid-path-chars.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst http = require('http');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst theExperimentallyDeterminedNumber = 39;
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_cifor (let i = 0; i <= theExperimentallyDeterminedNumber; i++) {
101cb0ef41Sopenharmony_ci  const prefix = 'a'.repeat(i);
111cb0ef41Sopenharmony_ci  for (let i = 0; i <= 32; i++) {
121cb0ef41Sopenharmony_ci    assert.throws(() => {
131cb0ef41Sopenharmony_ci      http.request({ path: prefix + String.fromCodePoint(i) }, assert.fail);
141cb0ef41Sopenharmony_ci    }, {
151cb0ef41Sopenharmony_ci      code: 'ERR_UNESCAPED_CHARACTERS',
161cb0ef41Sopenharmony_ci      name: 'TypeError',
171cb0ef41Sopenharmony_ci      message: 'Request path contains unescaped characters'
181cb0ef41Sopenharmony_ci    });
191cb0ef41Sopenharmony_ci  }
201cb0ef41Sopenharmony_ci}
21

Indexes created Thu Nov 07 10:32:03 CST 2024