@nxtedition/lib 14.1.1 → 14.1.3

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/package.json +1 -1
  2. package/undici.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "14.1.1",
3
+ "version": "14.1.3",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
package/undici.js CHANGED
@@ -10,10 +10,13 @@ module.exports.request = async function request(
10
10
  {
11
11
  logger,
12
12
  id = xuid(),
13
- retry: { count: maxRetries = 8 } = {},
13
+ retry: { count: maxRetries = 8, status = [] } = {},
14
14
  redirect: { count: maxRedirections = 3 } = {},
15
15
  dispatcher,
16
16
  signal,
17
+ headersTimeout,
18
+ bodyTimeout,
19
+ reset = false,
17
20
  method = 'GET',
18
21
  body,
19
22
  userAgent,
@@ -25,7 +28,7 @@ module.exports.request = async function request(
25
28
  method,
26
29
  body,
27
30
  headers: {
28
- 'req-id': id,
31
+ 'request-id': id,
29
32
  'user-agent': userAgent,
30
33
  ...headers,
31
34
  },
@@ -41,12 +44,15 @@ module.exports.request = async function request(
41
44
  try {
42
45
  const ures = await undici.request(url, {
43
46
  method,
47
+ reset,
44
48
  body,
45
49
  headers,
46
50
  signal,
47
51
  dispatcher,
48
52
  maxRedirections,
49
53
  throwOnError: true,
54
+ headersTimeout,
55
+ bodyTimeout,
50
56
  })
51
57
 
52
58
  upstreamLogger?.debug({ ureq, ures }, 'upstream request response')
@@ -90,7 +96,8 @@ module.exports.request = async function request(
90
96
  err.statusCode !== 429 &&
91
97
  err.statusCode !== 502 &&
92
98
  err.statusCode !== 503 &&
93
- err.statusCode !== 504
99
+ err.statusCode !== 504 &&
100
+ !status.includes(err.statusCode)
94
101
  ) {
95
102
  throw err
96
103
  }