node/test/parallel/test-url-null-char.js
Rich Trott d8c4e375f2
url: preserve null char in WHATWG URL errors
A null character in the middle of an invalid URL was resulting in an
error message that truncated the input string. This preserves the entire
input string in the error message.

Refs: https://github.com/nodejs/node/issues/39592

PR-URL: https://github.com/nodejs/node/pull/42263
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-03-11 05:51:41 +00:00

9 lines
139 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
assert.throws(
() => { new URL('a\0b'); },
{ input: 'a\0b' }
);