@nxtedition/nxt-undici 2.0.37 → 2.0.38

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
@@ -33,7 +33,7 @@ const dispatchers = {
33
33
  requestId: (await import('./interceptor/request-id.js')).default,
34
34
  }
35
35
 
36
- const dnsCache = new CacheableLookup()
36
+ const dnsCache = new CacheableLookup({ maxTtl: 10e3 })
37
37
  const defaultDispatcher = new undici.Agent({
38
38
  connect: {
39
39
  lookup: dnsCache.lookup,
package/lib/readable.js CHANGED
@@ -177,6 +177,15 @@ export class BodyReadable extends Readable {
177
177
  return null
178
178
  }
179
179
 
180
+ const contentLength = this.headers['content-length']
181
+ ? Number(this.headers['content-length'])
182
+ : null
183
+
184
+ if (contentLength != null && contentLength >= limit) {
185
+ this.on('error', () => {}).destroy()
186
+ return
187
+ }
188
+
180
189
  return await new Promise((resolve, reject) => {
181
190
  const onAbort = () => {
182
191
  this.destroy(signal.reason ?? new AbortError())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "2.0.37",
3
+ "version": "2.0.38",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",