“Socket hang up” error during request

后端 未结 7 785
北海茫月
北海茫月 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:29

    In my case, after upgrading to node 8.0.0, the post does not work anymore. adding Content-Length to header does not help. Have to add 'Connection': 'keep-alive' to the header instead to get this error away.

        let postOptions = {
            method: 'POST',
            form: form,
            url: finalUrl,
            followRedirect: false,
            headers:{
                'Connection': 'keep-alive'
            }
        };
        request(postOptions, handleSAMLResponse);
    

提交回复
热议问题