-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: allow Writeable.toWeb() to work on http.Outgoing message
Attempted to fix the issue by watering down the condition being checked in internal/streams/utils isWritableNodeStream utility Fixes: #44188 PR-URL: #45642 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
- Loading branch information
1 parent
6962ef0
commit 302c524
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { Writable } = require('stream'); | ||
|
||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
// Check if Writable.toWeb works on the response object after creating a server. | ||
const server = http.createServer( | ||
common.mustCall((req, res) => { | ||
const webStreamResponse = Writable.toWeb(res); | ||
assert.strictEqual(webStreamResponse instanceof WritableStream, true); | ||
res.end(); | ||
}) | ||
); | ||
|
||
server.listen( | ||
0, | ||
common.mustCall(() => { | ||
http.get( | ||
{ | ||
port: server.address().port, | ||
}, | ||
common.mustCall(() => { | ||
server.close(); | ||
}) | ||
); | ||
}) | ||
); |