“Socket hang up” error during request

后端 未结 7 772
北海茫月
北海茫月 2020-12-16 11:23

I try to make a GET request to some site (not mine own site) via http module of node.js version 0.8.14. Here is my code (CoffeeScript):

options = 
        ho         


        
7条回答
  •  执笔经年
    2020-12-16 11:38

    When upgrading from 0.10.33 to 0.12 of nodejs, this error was hit.

    In my case, there was a body (json) for the delete request. Earlier, node client was setting - 'transfer-encoding' as chunked - by default when 'content-length' is not set. It seems in recent version - node client stopped setting transfer-encoding by default.

    Fix was to set it in the request.

提交回复
热议问题