Node.js HTTP 请求代码优化建议
var http = require('http');\n\nvar options = {\n\thostname: '127.0.0.1',\n\tport: 8124,\n\tpath: '/upload',\n\tmethod: 'POST',\n\theaders: {\n\t\t'Content-Type': 'application/x-www-form-urlencoded'\n\t}\n};\n\nvar request = http.request(options, function (response) {});\n\nrequest.write(Buffer.from('Hello World'));\nrequest.end();\n\nrequest.on('error', function (error) {\n\tconsole.error('请求错误:', error);\n});
原文地址: https://www.cveoy.top/t/topic/p4Ah 著作权归作者所有。请勿转载和采集!