[Fizz] Always call flush() if it exists (#21625)
This commit is contained in:
parent
46926993fc
commit
cc4d24ab0b
|
@ -11,8 +11,6 @@ import type {Writable} from 'stream';
|
|||
|
||||
type MightBeFlushable = {
|
||||
flush?: () => void,
|
||||
// Legacy
|
||||
flushHeaders?: () => void,
|
||||
...
|
||||
};
|
||||
|
||||
|
@ -31,12 +29,9 @@ export function flushBuffered(destination: Destination) {
|
|||
// If we don't have any more data to send right now.
|
||||
// Flush whatever is in the buffer to the wire.
|
||||
if (typeof destination.flush === 'function') {
|
||||
// http.createServer response have flush(), but it has a different meaning and
|
||||
// is deprecated in favor of flushHeaders(). Detect to avoid a warning.
|
||||
if (typeof destination.flushHeaders !== 'function') {
|
||||
// By convention the Zlib streams provide a flush function for this purpose.
|
||||
destination.flush();
|
||||
}
|
||||
// By convention the Zlib streams provide a flush function for this purpose.
|
||||
// For Express, compression middleware adds this method.
|
||||
destination.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue