proxy-chain
proxy-chain copied to clipboard
feat: add requestFinished event for per request tracking
This pull request introduces a new requestFinished event to enable per-request tracking, complementing the existing socket-level tracking provided by the connectionClosed event. Implements #589
Key Changes:
-
New
requestFinishedEvent: The server now emits arequestFinishedevent upon the completion of a proxied request. This event provides granular details about each request, including its id, connectionId, and the original request object. -
Test: Added tests to test/server.js to ensure the
requestFinishedevent is emitted reliably across various proxy configurations, including HTTP, HTTPS, and scenarios with upstream proxies. -
Example: Included a new example file,
examples/request_finished.js, to demonstrate how to listen for and utilize therequestFinishedevent for monitoring purposes.
This enhancement provides more detailed visibility into individual requests flowing through the proxy, allowing for better logging and tracking.
Reference to previous PR: https://github.com/apify/proxy-chain/pull/590
I am waiting for https://github.com/apify/proxy-chain/pull/602 to be merged so I can use the HTTPS implementation here and mitigate conflicts from large updates.