Overview
wreq-js can emit structured native request lifecycle events through onRequestEvent and can attach an optional diagnostics payload to the final Response when captureDiagnostics is enabled.
Use this when you need to:
- render transport-phase progress such as connecting, waiting, and loading
- observe native download progress without consuming
response.bodyfirst - capture timing, address, or TLS peer details for debugging
Enable request events
Event types
Progress example
Enable diagnostics
response.diagnostics may include:
totalDurationMsheadersDurationMsstatuslocalAddrremoteAddrtlsPeerCertificatePresenttlsPeerCertificateChainLength
Session and transport defaults
You can enable diagnostics by default on a session or transport:onRequestEvent remains a per-request callback, so you still pass it to fetch() or session.fetch() for the specific requests you want to observe.
Notes
- Request events come from the native layer and reflect transport lifecycle phases, not application-level parsing.
body_progressis emitted during native download. You can still consumeresponse.body,response.text(),response.json(), and the other body helpers normally.- Diagnostics are optional and may vary by platform or native support level.