@nxtedition/nxt-undici 2.0.22 → 2.0.23

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.
@@ -6,7 +6,7 @@ class Handler {
6
6
  this.handler = handler
7
7
  this.md5 = md5
8
8
  this.length = length
9
- this.hasher = this.md5 ? crypto.createHash('md5') : null
9
+ this.hasher = opts.md5 && this.md5 ? crypto.createHash('md5') : null
10
10
  this.pos = 0
11
11
  this.abort = null
12
12
  }
@@ -4,6 +4,7 @@ import { findHeader } from '../utils.js'
4
4
  class Handler {
5
5
  constructor(opts, { handler }) {
6
6
  this.handler = handler
7
+ this.opts = opts
7
8
  this.md5 = null
8
9
  this.length = null
9
10
  this.hasher = null
@@ -29,7 +30,7 @@ class Handler {
29
30
  onHeaders(statusCode, rawHeaders, resume, statusMessage, headers) {
30
31
  this.md5 = findHeader(rawHeaders, 'content-md5')
31
32
  this.length = findHeader(rawHeaders, 'content-length')
32
- this.hasher = this.md5 != null ? crypto.createHash('md5') : null
33
+ this.hasher = this.opts.md5 && this.md5 != null ? crypto.createHash('md5') : null
33
34
 
34
35
  return this.handler.onHeaders(statusCode, rawHeaders, resume, statusMessage, headers)
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "2.0.22",
3
+ "version": "2.0.23",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",
@@ -13,7 +13,7 @@
13
13
  "cacheable-lookup": "^7.0.0",
14
14
  "http-errors": "^2.0.0",
15
15
  "lru-cache": "^10.1.0",
16
- "undici": "^6.0.0"
16
+ "undici": "^6.0.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^20.10.3",