简体   繁体   English

Node.js HTTP请求和获取之间有什么区别?

[英]What's the difference between Node.js HTTP request and get?

What's the difference between Node.js HTTP request and get? Node.js HTTP请求和获取之间有什么区别?

(and when to use which) (以及何时使用哪个)

Docs: https://nodejs.org/api/http.html 文件: https//nodejs.org/api/http.html

From the exact docs you linked: 从您链接的确切文档中:

Since most requests are GET requests without bodies, Node.js provides this convenience method. 由于大多数请求都是没有主体的GET请求,因此Node.js提供了这种便捷方法。 The only difference between this method and http.request() is that it sets the method to GET and calls req.end() automatically. 此方法与http.request()之间的唯一区别是,它将方法设置为GET并自动调用req.end()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM