test: replace deprecated regex test assertions in http trailers test

PR-URL: https://github.com/nodejs/node/pull/60831
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Aditya Chopra authored and RafaelGSS committed 2026-01-13 10:04:31 -03:00
1 parent 256770944a
commit b08cb5657e
1 file changed
+6 -4
+6 -4
View File
@@ -43,8 +43,9 @@ function testHttp10(port, callback) {
c.on('end', common.mustCall(() => {
c.end();
assert.ok(
!/x-foo/.test(res_buffer),
assert.doesNotMatch(
res_buffer,
/x-foo/,
`No trailer in HTTP/1.0 response. Response buffer: ${res_buffer}`
);
callback();
@@ -68,8 +69,9 @@ function testHttp11(port, callback) {
res_buffer += chunk;
if (/0\r\n/.test(res_buffer)) { // got the end.
clearTimeout(tid);
assert.ok(
/0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer),
assert.match(
res_buffer,
/0\r\nx-foo: bar\r\n\r\n$/,
`No trailer in HTTP/1.1 response. Response buffer: ${res_buffer}`
);
callback();