@nxtedition/nxt-undici 7.2.8 → 7.2.9

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 +9 -2
  2. package/package.json +1 -1
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)
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.9",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",