@nxtedition/nxt-undici 4.1.3 → 4.2.1

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.
package/lib/index.js CHANGED
@@ -68,6 +68,7 @@ function wrapDispatcher(dispatcher) {
68
68
  error: opts.error ?? true,
69
69
  verify: opts.verify ?? true,
70
70
  logger: opts.logger ?? null,
71
+ dns: opts.dns ?? true,
71
72
  lookup:
72
73
  opts.lookup ??
73
74
  ((origin, opts, callback) =>
@@ -77,7 +78,6 @@ function wrapDispatcher(dispatcher) {
77
78
  ? origin[Math.floor(Math.random() * origin.length)]
78
79
  : origin,
79
80
  )),
80
- dns: opts.dns ?? true,
81
81
  },
82
82
  handler,
83
83
  )
@@ -72,7 +72,7 @@ export default (interceptorOpts) => (dispatch) => (opts, handler) => {
72
72
  ? val[Math.floor(val.length * Math.random())].address
73
73
  : val?.address ?? val
74
74
  dispatch(
75
- { ...opts, origin: url.origin },
75
+ { ...opts, origin: url.origin, headers: { ...opts.headers, host: url.host } },
76
76
  resolver.clear ? new Handler({ resolver, key: hostname }, { handler }) : handler,
77
77
  )
78
78
  }
@@ -9,11 +9,13 @@ class Handler extends DecoratorHandler {
9
9
  #decoder = null
10
10
  #headers = null
11
11
  #body = ''
12
+ #opts
12
13
  #errored = false
13
14
 
14
15
  constructor(opts, { handler }) {
15
16
  super(handler)
16
17
 
18
+ this.#opts = opts
17
19
  this.#handler = handler
18
20
  }
19
21
 
@@ -71,6 +73,7 @@ class Handler extends DecoratorHandler {
71
73
  Error.stackTraceLimit = 0
72
74
  try {
73
75
  err = Object.assign(createHttpError(this.#statusCode), {
76
+ url: new URL(this.#opts.path, this.#opts.origin).href,
74
77
  reason: this.#body?.reason,
75
78
  error: this.#body?.error,
76
79
  headers: this.#headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "4.1.3",
3
+ "version": "4.2.1",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",