@nxtedition/nxt-undici 7.2.7 → 7.2.8

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 +1 -27
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -108,32 +108,6 @@ function wrapDispatch(dispatcher) {
108
108
  headers['user-agent'] ??=
109
109
  opts.userAgent ?? globalThis.userAgent ?? globalThis.__nxt_undici_user_agent
110
110
 
111
- let priority
112
- if (opts.priority == null) {
113
- // Do nothing
114
- } else if (opts.priority === 'low' || opts.priority === 0 || opts.priority === '0') {
115
- headers['nxt-priority'] = 'low'
116
- priority = 0
117
- } else if (opts.priority === 'normal' || opts.priority === 1 || opts.priority === '1') {
118
- headers['nxt-priority'] = 'normal'
119
- priority = 1
120
- } else if (opts.priority === 'high' || opts.priority === 2 || opts.priority === '2') {
121
- headers['nxt-priority'] = 'high'
122
- priority = 2
123
- } else {
124
- throw new TypeError('invalid opts.priority')
125
- }
126
-
127
- if (priority == null && headers['nxt-priority']) {
128
- if (headers['nxt-priority'] === 'low' || headers['nxt-priority'] === '0') {
129
- priority = 0
130
- } else if (headers['nxt-priority'] === 'normal' || headers['nxt-priority'] === '1') {
131
- priority = 1
132
- } else if (headers['nxt-priority'] === 'high' || headers['nxt-priority'] === '2') {
133
- priority = 2
134
- }
135
- }
136
-
137
111
  if (globalThis.__nxt_undici_global_headers) {
138
112
  Object.assign(headers, globalThis.__nxt_undici_global_headers)
139
113
  }
@@ -164,7 +138,7 @@ function wrapDispatch(dispatcher) {
164
138
  logger: opts.logger ?? null,
165
139
  dns: opts.dns ?? true,
166
140
  connect: opts.connect,
167
- priority,
141
+ priority: opts.priority ?? headers['nxt-priority'],
168
142
  lookup: opts.lookup ?? defaultLookup,
169
143
  },
170
144
  handler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.2.7",
3
+ "version": "7.2.8",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",