ELECTRON 发起 网络请求

(function () {
            let request = ELECTRON.remote.net.request('URL what you want');
            request.on('response', function (response) {
                
                console.log(response.statusCode);
                console.log(response.headers);
                response.on('data', function (chunk) {
                    //chunk.toString()是响应内容
                    console.log(chunk.toString());
                });
            });
            request.end();//这句一定要有
 
        })();
posted on 2022-09-01 15:28  wakaka_wka  阅读(950)  评论(0编辑  收藏  举报