@nxtedition/nxt-undici 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,25 +40,25 @@ class Handler {
40
40
 
41
41
  onBodySent(chunk) {
42
42
  if (this.stats.firstBodySent === -1) {
43
- this.stats.firstBodySent = this.stats.start - performance.now()
43
+ this.stats.firstBodySent = performance.now() - this.stats.start
44
44
  }
45
45
 
46
46
  return this.handler.onBodySent(chunk)
47
47
  }
48
48
 
49
49
  onRequestSent() {
50
- this.stats.lastBodySent = this.stats.start - performance.now()
50
+ this.stats.lastBodySent = performance.now() - this.stats.start
51
51
 
52
52
  return this.handler.onRequestSent()
53
53
  }
54
54
 
55
55
  onHeaders(statusCode, rawHeaders, resume, statusMessage) {
56
- this.stats.headers = this.stats.start - performance.now()
56
+ this.stats.headers = performance.now() - this.stats.start
57
57
 
58
58
  this.logger.debug(
59
59
  {
60
60
  ures: { statusCode, headers: parseHeaders(rawHeaders) },
61
- elapsedTime: performance.now() - this.stats.start,
61
+ elapsedTime: this.stats.headers,
62
62
  },
63
63
  'upstream request response',
64
64
  )
@@ -78,7 +78,10 @@ class Handler {
78
78
  this.stats.lastBodyReceived = this.stats.start - performance.now()
79
79
  this.stats.end = this.stats.lastBodyReceived
80
80
 
81
- this.logger.debug({ bytesRead: this.pos, stats: this.stats }, 'upstream request completed')
81
+ this.logger.debug(
82
+ { bytesRead: this.pos, elapsedTime: this.stats.end, stats: this.stats },
83
+ 'upstream request completed',
84
+ )
82
85
  return this.handler.onComplete(rawTrailers)
83
86
  }
84
87
 
@@ -86,9 +89,15 @@ class Handler {
86
89
  this.stats.end = this.stats.start - performance.now()
87
90
 
88
91
  if (this.aborted) {
89
- this.logger.debug({ bytesRead: this.pos, stats: this.stats, err }, 'upstream request aborted')
92
+ this.logger.debug(
93
+ { bytesRead: this.pos, elapsedTime: this.stats.end, stats: this.stats, err },
94
+ 'upstream request aborted',
95
+ )
90
96
  } else {
91
- this.logger.error({ bytesRead: this.pos, err }, 'upstream request failed')
97
+ this.logger.error(
98
+ { bytesRead: this.pos, elapsedTime: this.stats.end, err },
99
+ 'upstream request failed',
100
+ )
92
101
  }
93
102
  return this.handler.onError(err)
94
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",