@nxtedition/nxt-undici 7.3.21 → 7.3.22

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.
@@ -52,7 +52,7 @@ class Handler extends DecoratorHandler {
52
52
  return super.onHeaders(statusCode, headers, resume)
53
53
  }
54
54
 
55
- if (isDisturbed(this.#opts.body)) {
55
+ if (statusCode !== 303 && isDisturbed(this.#opts.body)) {
56
56
  throw new Error(`Disturbed request cannot be redirected.`)
57
57
  }
58
58
 
@@ -102,8 +102,12 @@ class Handler extends DecoratorHandler {
102
102
 
103
103
  // https://tools.ietf.org/html/rfc7231#section-6.4.4
104
104
  // In case of HTTP 303, always replace method to be either HEAD or GET
105
- if (statusCode === 303 && this.#opts.method !== 'HEAD') {
106
- this.#opts = { ...this.#opts, method: 'GET', body: null }
105
+ if (statusCode === 303) {
106
+ this.#opts = {
107
+ ...this.#opts,
108
+ method: this.#opts.method !== 'HEAD' ? 'GET' : 'HEAD',
109
+ body: null,
110
+ }
107
111
  }
108
112
  }
109
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.3.21",
3
+ "version": "7.3.22",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",