Skip to content

Commit 63f5803

Browse files
committed
preserve Upgrade header
end request in hijack mode
1 parent 049e1aa commit 63f5803

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/modem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Modem.prototype.dial = function (options, callback) {
227227

228228
if (options.hijack) {
229229
optionsf.headers.Connection = 'Upgrade';
230-
optionsf.headers.Upgrade = 'tcp';
230+
optionsf.headers.Upgrade ??= 'tcp';
231231
}
232232

233233
if (this.socketPath) {
@@ -366,7 +366,7 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
366366
data.pipe(req);
367367
}
368368

369-
if (!context.hijack && !context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) {
369+
if (!context.openStdin && (typeof data === 'string' || data === undefined || Buffer.isBuffer(data))) {
370370
req.end();
371371
}
372372
};

0 commit comments

Comments
 (0)