@nxtedition/lib 15.0.12 → 15.0.14
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/{undici → lib/undici}/index.js +1 -4
- package/{undici → lib/undici}/interceptor/abort.js +1 -1
- package/{undici → lib/undici}/interceptor/content.js +1 -1
- package/{undici → lib/undici}/interceptor/log.js +1 -1
- package/{undici → lib/undici}/interceptor/response-status-retry.js +1 -1
- package/package.json +2 -1
- package/http-client.js +0 -2
- package/undici/interceptor/response-body-dump.js +0 -46
- /package/{undici → lib/undici}/interceptor/catch.js +0 -0
- /package/{undici → lib/undici}/interceptor/proxy.js +0 -0
- /package/{undici → lib/undici}/interceptor/redirect.js +0 -0
- /package/{undici → lib/undici}/interceptor/response-body-retry.js +0 -0
- /package/{undici → lib/undici}/interceptor/response-retry.js +0 -0
- /package/{undici → lib/undici}/interceptor/signal.js +0 -0
- /package/{undici → lib/undici}/utils.js +0 -0
|
@@ -3,7 +3,7 @@ const createError = require('http-errors')
|
|
|
3
3
|
const xuid = require('xuid')
|
|
4
4
|
const undici = require('undici')
|
|
5
5
|
const stream = require('stream')
|
|
6
|
-
const { parseHeaders } = require('
|
|
6
|
+
const { parseHeaders } = require('../../http')
|
|
7
7
|
|
|
8
8
|
class Readable extends stream.Readable {
|
|
9
9
|
constructor({ statusCode, statusMessage, headers, size, ...opts }) {
|
|
@@ -67,7 +67,6 @@ const dispatchers = {
|
|
|
67
67
|
abort: require('./interceptor/abort.js'),
|
|
68
68
|
catch: require('./interceptor/catch.js'),
|
|
69
69
|
content: require('./interceptor/content.js'),
|
|
70
|
-
responseBodyDump: require('./interceptor/response-body-dump.js'),
|
|
71
70
|
log: require('./interceptor/log.js'),
|
|
72
71
|
redirect: require('./interceptor/redirect.js'),
|
|
73
72
|
responseBodyRetry: require('./interceptor/response-body-retry.js'),
|
|
@@ -92,7 +91,6 @@ async function request(urlOrOpts, opts = {}) {
|
|
|
92
91
|
|
|
93
92
|
const method = opts.method ?? (opts.body ? 'POST' : 'GET')
|
|
94
93
|
const idempotent = opts.idempotent ?? (method === 'GET' || method === 'HEAD')
|
|
95
|
-
const dump = opts.dump ?? method === 'HEAD'
|
|
96
94
|
|
|
97
95
|
let headers
|
|
98
96
|
if (Array.isArray(opts.headers)) {
|
|
@@ -119,7 +117,6 @@ async function request(urlOrOpts, opts = {}) {
|
|
|
119
117
|
signal: opts.signal,
|
|
120
118
|
retry: opts.retry ?? 8,
|
|
121
119
|
follow: { count: opts.maxRedirections ?? 8, ...opts.redirect, ...opts.follow },
|
|
122
|
-
dump,
|
|
123
120
|
logger: opts.logger,
|
|
124
121
|
}
|
|
125
122
|
|
|
@@ -2,7 +2,7 @@ const crypto = require('node:crypto')
|
|
|
2
2
|
const stream = require('node:stream')
|
|
3
3
|
const assert = require('node:assert')
|
|
4
4
|
const { findHeader } = require('../utils')
|
|
5
|
-
const { isStream } = require('
|
|
5
|
+
const { isStream } = require('../../../stream')
|
|
6
6
|
|
|
7
7
|
class Handler {
|
|
8
8
|
constructor(opts, { handler }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const assert = require('node:assert')
|
|
2
2
|
const { isDisturbed, retryAfter: retryAfterFn } = require('../utils')
|
|
3
3
|
const createError = require('http-errors')
|
|
4
|
-
const { parseHeaders } = require('
|
|
4
|
+
const { parseHeaders } = require('../../../http')
|
|
5
5
|
|
|
6
6
|
class Handler {
|
|
7
7
|
constructor(opts, { dispatch, handler }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"files": [
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"ass.js",
|
|
9
9
|
"rxjs/*",
|
|
10
10
|
"util/*",
|
|
11
|
+
"lib/*",
|
|
11
12
|
"undici/*",
|
|
12
13
|
"http-client.js",
|
|
13
14
|
"subtract-ranges.js",
|
package/http-client.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const { AbortError } = require('../../errors')
|
|
2
|
-
|
|
3
|
-
class Handler {
|
|
4
|
-
constructor(opts, { handler }) {
|
|
5
|
-
this.handler = handler
|
|
6
|
-
this.pos = 0
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
onConnect(abort) {
|
|
10
|
-
this.abort = abort
|
|
11
|
-
return this.handler.onConnect?.(abort)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
onBodySent(chunk) {
|
|
15
|
-
return this.handler.onBodySent?.(chunk)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
onHeaders(statusCode, rawHeaders, resume, statusMessage) {
|
|
19
|
-
return this.handler.onHeaders?.(statusCode, rawHeaders, resume, statusMessage)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
onData(chunk) {
|
|
23
|
-
this.pos += chunk.length
|
|
24
|
-
if (this.pos < 128 * 1024) {
|
|
25
|
-
return true
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this.handler.onComplete?.([])
|
|
29
|
-
this.handler = null
|
|
30
|
-
|
|
31
|
-
this.abort(new AbortError('dump'))
|
|
32
|
-
|
|
33
|
-
return false
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
onComplete(rawTrailers) {
|
|
37
|
-
return this.handler.onComplete?.([])
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onError(err) {
|
|
41
|
-
return this.handler?.onError?.(err)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = (dispatch) => (opts, handler) =>
|
|
46
|
-
opts.dump ? dispatch(opts, new Handler(opts, { handler })) : dispatch(opts, handler)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|