Skip to content

Commit

Permalink
Support node 20 in http
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan committed Nov 29, 2023
1 parent 6077c71 commit 00df7d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
'response',
(response: http.IncomingMessage & { aborted?: boolean }) => {
this._diag.debug('outgoingRequest on response()');
if (request.listenerCount('request') <= 0) {
response.resume();
}
const responseAttributes =
utils.getOutgoingRequestAttributesOnResponse(response);
span.setAttributes(responseAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function sendRequestTwice(
port: number
): Promise<Buffer> {
return new Promise((resolve, reject) => {
const request = 'GET /raw HTTP/1.1\n\n';
const request = `GET /raw HTTP/1.1\r\nHost: ${host}:${port}\r\n\r\n`;
const socket = net.createConnection({ host, port }, () => {
socket.write(`${request}${request}`, err => {
if (err) reject(err);
Expand Down

0 comments on commit 00df7d4

Please sign in to comment.