Skip to content

http: check "parser" existence in various conditions for http client

Fixes: #26404 (closed) and Refs: #26351 (closed)

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

After analyzing the comments, the fix and the test in #26402 for http server, got inspired to try out a similar fix and a test as to check for the parserexistence in various conditions for http client.

My local test passed in repl with similar script from #26404 (closed):

'use strict';

const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('okay');
});

server.listen(1337, '127.0.0.1');

const req = http.request({
  port: 1337,
  host: '127.0.0.1',
  method: 'GET',
});

req.write('');
req.end(() => { delete req.socket.parser; });

Merge request reports

Loading