From 933e63304a77ae3faf7cf4ed2d856d0d15351382 Mon Sep 17 00:00:00 2001 From: Aleksei Androsov Date: Wed, 3 Apr 2024 18:40:48 +0300 Subject: [PATCH] Add timestamps for body and req end (#54) --- lib/request.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/request.js b/lib/request.js index c0d3d86..ed09107 100644 --- a/lib/request.js +++ b/lib/request.js @@ -284,10 +284,14 @@ class Request { } ); if ( this.options.body ) { - this.req.write( this.options.body ); + this.req.write( this.options.body, () => { + this.timestamps.body = Date.now(); + } ); } - this.req.end(); + this.req.end( () => { + this.timestamps.request_end = Date.now(); + } ); } catch ( e ) { this.do_fail( e );