@askrjs/fetch 0.0.6 → 0.2.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/dist/client.js +3 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -236,7 +236,7 @@ function createFetch(options = {}) {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
const middleware = options.middleware ?? [];
|
|
239
|
-
const dispatch = (index, context) => index === middleware.length ? terminal(context) : Promise.resolve().then(() => middleware[index](context, (next = context) => dispatch(index + 1, next)))
|
|
239
|
+
const dispatch = (index, context) => index === middleware.length ? terminal(context) : Promise.resolve().then(() => middleware[index](context, (next = context) => dispatch(index + 1, next)));
|
|
240
240
|
try {
|
|
241
241
|
return await dispatch(0, Object.freeze({
|
|
242
242
|
request,
|
|
@@ -247,6 +247,8 @@ function createFetch(options = {}) {
|
|
|
247
247
|
...body === void 0 ? {} : { replayableBody: !(body instanceof ReadableStream) },
|
|
248
248
|
...timeout === void 0 ? {} : { deadline: Date.now() + timeout }
|
|
249
249
|
}));
|
|
250
|
+
} catch (error) {
|
|
251
|
+
return failure("middleware", error, url);
|
|
250
252
|
} finally {
|
|
251
253
|
cleanup();
|
|
252
254
|
}
|