@nxtedition/nxt-undici 2.0.22 → 2.0.24

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.
@@ -4,7 +4,7 @@ import { findHeader } from '../utils.js'
4
4
  class Handler {
5
5
  constructor(opts, { handler, md5, length }) {
6
6
  this.handler = handler
7
- this.md5 = md5
7
+ this.md5 = opts.md5 ? md5 : null
8
8
  this.length = length
9
9
  this.hasher = this.md5 ? crypto.createHash('md5') : null
10
10
  this.pos = 0
@@ -29,7 +29,7 @@ class Handler {
29
29
  }
30
30
 
31
31
  onRequestSent() {
32
- const hash = this.hasher?.digest('base64')
32
+ const hash = this.hasher?.digest('base64') ?? null
33
33
 
34
34
  if (this.length != null && this.pos !== Number(this.length)) {
35
35
  this.abort(
@@ -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
@@ -27,7 +28,7 @@ class Handler {
27
28
  }
28
29
 
29
30
  onHeaders(statusCode, rawHeaders, resume, statusMessage, headers) {
30
- this.md5 = findHeader(rawHeaders, 'content-md5')
31
+ this.md5 = this.opts.md5 ? findHeader(rawHeaders, 'content-md5') : null
31
32
  this.length = findHeader(rawHeaders, 'content-length')
32
33
  this.hasher = this.md5 != null ? crypto.createHash('md5') : null
33
34
 
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.24",
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",