-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed OutgoingMessage so that it inherits from stream.Writable instead of stream #45834
Changes from all commits
7f40107
d622c0f
2531694
e46d162
a792f55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you forgot to remove this file |
||
|
||
cd ~/node/test/parallel | ||
|
||
mkdir test-stream-writable-dir | ||
|
||
for file in ./*.js | ||
do | ||
if [[ "$file" =~ .*"test-stream-writable".* ]]; then | ||
cp $file "./test-stream-writable-dir/$file" | ||
echo "{$file} copied" | ||
fi | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
const { stream, Writable } = require('stream'); | ||
const { once } = require('events'); | ||
|
||
async function test() { | ||
const o = new http.OutgoingMessage(); | ||
assert.strictEqual(o instanceof http.OutgoingMessage, true); | ||
assert.strictEqual(o instanceof Writable, true); | ||
|
||
let external; | ||
|
||
const server = http.createServer(async (req, nodeStreamResponse) => { | ||
const isOutgoingMessage = nodeStreamResponse instanceof http.OutgoingMessage; | ||
//const isStream = stream.isInstance(nodeStreamResponse); | ||
const isWritable = nodeStreamResponse instanceof Writable; | ||
|
||
assert.strictEqual(nodeStreamResponse.writable, true); | ||
assert.strictEqual(isOutgoingMessage, true); | ||
assert.strictEqual(isWritable, true); | ||
|
||
|
||
const b = typeof nodeStreamResponse?._writableState | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and other lines won't pass the linter. Make sure you run |
||
|
||
assert.strictEqual(b, 'object') | ||
|
||
const webStreamResponse = Writable.toWeb(nodeStreamResponse); | ||
|
||
setImmediate(common.mustCall(() => { | ||
external.abort(); | ||
nodeStreamResponse.end('Hello World\n'); | ||
})); | ||
}); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
external = http.get(`http://127.0.0.1:${server.address().port}`); | ||
external.on('error', common.mustCall(() => { | ||
server.close(); | ||
})); | ||
})); | ||
} | ||
|
||
test(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These newline only file changes should be removed (including the one in the test file).