简体   繁体   English

如何使用 request npm 模块判断 http 请求是否完成?

[英]How can I tell if http request is complete using the request npm module?

I am using the request npm library( https://github.com/request/request ), and would like to know when the http get request is complete.我正在使用请求 npm 库( https://github.com/request/request ),并想知道 http get 请求何时完成。 Does this request module support an end listener?此请求模块是否支持结束侦听器?

request(url, callback).on('end',function(){})

If not, how can I determine when the request is complete?如果没有,我如何确定请求何时完成?

The request is complete when callback is called. callback时请求完成。 Otherwise if you don't use a callback, you can listen for the response event and listen for end on the response stream passed to the response event handler.否则,如果您不使用回调,则可以侦听response事件并侦听传递给response事件处理程序的响应流的end

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

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