【问题标题】:Node.JS: What happens to postdata when client request is interrupted?Node.JS:当客户端请求被中断时,postdata 会发生什么?
【发布时间】:2013-02-03 02:50:46
【问题描述】:

the Node.JS docs for HTTP (v0.8.20) 的ServerRequest 下,我看到dataend 的事件。我没有看到error 的活动。

通常,如果在接收数据时出现中断,我可以通过查看error 来检测它。但这对 postdata 有用吗?

如何确定是否收到了整个postdata,并且没有因为网络故障而被截断?

【问题讨论】:

    标签: node.js http post error-handling


    【解决方案1】:

    我没有用实际运行的代码确认这一点,但只是看一下手册,http.ServerRequest 是一个Readable Stream,并且记录了 Event: 'error'

    【讨论】:

      【解决方案2】:

      最近有一个关于此的问题:https://github.com/joyent/node/pull/4775

      一般来说,您应该始终侦听和处理来自任何流和事件发射器的错误

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-25
        • 1970-01-01
        • 1970-01-01
        • 2021-01-05
        • 2017-03-24
        • 2012-05-31
        • 1970-01-01
        • 2011-09-03
        相关资源
        最近更新 更多