outgoingMessage.end(chunk[, encoding][, callback])
chunk<string> | <Buffer> | <Uint8Array>encoding<string> 可选,默认:utf8callback<Function> 可选- 返回:<this>
完成发送出站消息。如果消息体的任何部分尚未发送,它会将这些部分刷新到底层系统。如果消息是分块的,它将发送终止块 `0
`,并发送尾部信息(如果有)。
【Finishes the outgoing message. If any parts of the body are unsent, it will
flush them to the underlying system. If the message is chunked, it will
send the terminating chunk 0\r\n\r\n, and send the trailers (if any).】
如果指定了 chunk,等同于先调用 outgoingMessage.write(chunk, encoding),然后调用 outgoingMessage.end(callback)。
【If chunk is specified, it is equivalent to calling
outgoingMessage.write(chunk, encoding), followed by
outgoingMessage.end(callback).】
如果提供了 callback,当消息完成时它将被调用(相当于 'finish' 事件的监听器)。
【If callback is provided, it will be called when the message is finished
(equivalent to a listener of the 'finish' event).】