Skip to content

request.raw.res.end() method is called twice #2966

@jbpionnier

Description

@jbpionnier

request.raw.res.end() method is called twice
https://nodejs.org/api/http.html#http_response_end_data_encoding_callback

I think the problem comes from here
https://github.com/hapijs/hapi/blob/master/lib/transmit.js#L295

I test with :

server.ext('onRequest', function (request, reply) {
  const res = request.raw.res
  const func = res.end

  res.end = function (data, encoding) {
    console.log('method is called twice')
    func.call(res, data, encoding)
  }

  reply.continue()
});

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions