@nxtedition/nxt-undici 7.2.8 → 7.2.10

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.
Files changed (2) hide show
  1. package/lib/index.js +11 -2
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -104,9 +104,16 @@ function wrapDispatch(dispatcher) {
104
104
 
105
105
  const headers = parseHeaders(opts.headers)
106
106
 
107
- // TODO (fix): Move to interceptor?
108
- headers['user-agent'] ??=
107
+ const userAgent =
109
108
  opts.userAgent ?? globalThis.userAgent ?? globalThis.__nxt_undici_user_agent
109
+ if (userAgent != null) {
110
+ headers['user-agent'] ??=
111
+ opts.userAgent ?? globalThis.userAgent ?? globalThis.__nxt_undici_user_agent
112
+ }
113
+
114
+ if (opts.priority != null) {
115
+ headers['nxt-priority'] = String(opts.priority)
116
+ }
110
117
 
111
118
  if (globalThis.__nxt_undici_global_headers) {
112
119
  Object.assign(headers, globalThis.__nxt_undici_global_headers)
@@ -128,6 +135,7 @@ function wrapDispatch(dispatcher) {
128
135
  opts.timeout?.headers ?? opts.headersTimeout ?? opts.headerTimeout ?? opts.timeout,
129
136
  bodyTimeout: opts.timeout?.body ?? opts.bodyTimeout ?? opts.timeout,
130
137
  idempotent: opts.idempotent,
138
+ typeOfService: opts.typeOfService ?? 0,
131
139
  retry: opts.retry ?? 8,
132
140
  proxy: opts.proxy ?? false,
133
141
  cache: opts.cache ?? false,
@@ -197,6 +205,7 @@ export function dispatch(dispatcher, opts, handler) {
197
205
  * cache: object | boolean | null | undefined,
198
206
  * upgrade: object | boolean | null | undefined,
199
207
  * follow: object | boolean | null | undefined,
208
+ * typeOfService: number | null | undefined,
200
209
  * error: object | boolean | null | undefined,
201
210
  * verify: object | boolean | null | undefined,
202
211
  * logger: LoggerLike | null | undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.2.8",
3
+ "version": "7.2.10",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",
@@ -9,15 +9,15 @@
9
9
  "lib/*"
10
10
  ],
11
11
  "dependencies": {
12
- "@nxtedition/scheduler": "^3.0.0",
13
- "@nxtedition/undici": "^11.1.1",
12
+ "@nxtedition/scheduler": "^3.0.1",
13
+ "@nxtedition/undici": "^11.1.3",
14
14
  "cache-control-parser": "^2.0.6",
15
15
  "fast-querystring": "^1.1.2",
16
16
  "http-errors": "^2.0.1",
17
17
  "xxhash-wasm": "^1.1.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/node": "^25.1.0",
20
+ "@types/node": "^25.2.0",
21
21
  "eslint": "^9.39.2",
22
22
  "eslint-plugin-n": "^17.23.2",
23
23
  "husky": "^9.1.7",
@@ -26,7 +26,7 @@
26
26
  "prettier": "^3.8.1",
27
27
  "send": "^1.2.1",
28
28
  "tap": "^21.5.0",
29
- "undici-types": "^7.19.2"
29
+ "undici-types": "^7.20.0"
30
30
  },
31
31
  "scripts": {
32
32
  "prepare": "husky",