@nxtedition/nxt-undici 1.0.13 → 1.1.0
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 +7 -0
- package/lib/interceptor/abort.js +4 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -217,6 +217,12 @@ async function request(url, opts) {
|
|
|
217
217
|
dispatcherCache.set(dispatcher, dispatch)
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// TODO (fix): retry support
|
|
221
|
+
let body = opts.body
|
|
222
|
+
if (typeof body === 'function') {
|
|
223
|
+
body = await opts.body({ signal: opts.signal })
|
|
224
|
+
}
|
|
225
|
+
|
|
220
226
|
return new Promise((resolve, reject) =>
|
|
221
227
|
dispatch(
|
|
222
228
|
{
|
|
@@ -229,6 +235,7 @@ async function request(url, opts) {
|
|
|
229
235
|
path: url.path ?? (url.search ? `${url.pathname}${url.search ?? ''}` : url.pathname),
|
|
230
236
|
query: opts.query,
|
|
231
237
|
reset: opts.reset ?? false,
|
|
238
|
+
blocking: opts.blocking ?? false,
|
|
232
239
|
headersTimeout: opts.headersTimeout,
|
|
233
240
|
bodyTimeout: opts.bodyTimeout,
|
|
234
241
|
idempotent,
|
package/lib/interceptor/abort.js
CHANGED
|
@@ -66,4 +66,7 @@ class Handler {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
module.exports = (dispatch) => (opts, handler) =>
|
|
69
|
+
module.exports = (dispatch) => (opts, handler) =>
|
|
70
|
+
opts.method === 'GET' || opts.method === 'HEAD'
|
|
71
|
+
? dispatch(opts, new Handler(opts, { handler }))
|
|
72
|
+
: dispatch(opts, handler)
|