简体   繁体   中英

Node.js request module global events

Is it possible using request to capture the events that are fired at the start and end of a request? I would like to attach a global event handler to request so that I can count the number of requests in progress at any given time.

Rather than attaching .on('response') and .on('end') to every request call in my code, I'd like to centralize it in one place.

您可以使用您的wrapper.in节点6包装请求模块并调用请求,您可以使用代理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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