@applitools/req
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -149,3 +149,3 @@ import { AbortController } from 'abort-controller'; | ||
return ((_a = options === null || options === void 0 ? void 0 : options.hooks) !== null && _a !== void 0 ? _a : []).reduce(async (request, hooks) => { | ||
var _a; | ||
var _a, _b; | ||
request = await request; | ||
@@ -157,4 +157,6 @@ const result = await ((_a = hooks.beforeRequest) === null || _a === void 0 ? void 0 : _a.call(hooks, { request, options, ...rest })); | ||
return result; | ||
else if (utils.types.has(result, 'url')) | ||
return new Request(result.url, (_b = result.request) !== null && _b !== void 0 ? _b : result); | ||
else | ||
return new Request(result.url, result); | ||
return new Request(result.request, result); | ||
}, request); | ||
@@ -165,3 +167,3 @@ } | ||
return ((_a = options === null || options === void 0 ? void 0 : options.hooks) !== null && _a !== void 0 ? _a : []).reduce(async (request, hooks) => { | ||
var _a; | ||
var _a, _b; | ||
request = await request; | ||
@@ -177,4 +179,6 @@ if (request === stop) | ||
return result; | ||
else if (utils.types.has(result, 'url')) | ||
return new Request(result.url, (_b = result.request) !== null && _b !== void 0 ? _b : result); | ||
else | ||
return new Request(result.url, result); | ||
return new Request(result.request, result); | ||
}, request); | ||
@@ -185,3 +189,3 @@ } | ||
return (_b = (((_a = options === null || options === void 0 ? void 0 : options.hooks) !== null && _a !== void 0 ? _a : []))) === null || _b === void 0 ? void 0 : _b.reduce(async (response, hooks) => { | ||
var _a; | ||
var _a, _b, _c, _d; | ||
response = await response; | ||
@@ -194,3 +198,3 @@ const result = await ((_a = hooks.afterResponse) === null || _a === void 0 ? void 0 : _a.call(hooks, { response, options, ...rest })); | ||
else | ||
return new Response(result.body, result); | ||
return new Response((_b = result.body) !== null && _b !== void 0 ? _b : (_c = result.response) === null || _c === void 0 ? void 0 : _c.body, (_d = result.response) !== null && _d !== void 0 ? _d : result); | ||
}, response); | ||
@@ -197,0 +201,0 @@ } |
{ | ||
"name": "@applitools/req", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Applitools fetch-based request library", | ||
@@ -62,3 +62,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@applitools/utils": "1.3.34", | ||
"@applitools/utils": "1.3.35", | ||
"abort-controller": "3.0.0", | ||
@@ -65,0 +65,0 @@ "node-fetch": "3.3.1", |
@@ -115,3 +115,3 @@ export type Stop = typeof stop; | ||
afterOptionsMerged?(options: { options: TOptions; }): void | TOptions; | ||
beforeRequest?(options: { request: Request; options?: undefined | TOptions; }): void | Request | (RequestInit & { url: string | URL; }) | Promise<void | Request | (RequestInit & { url: string | URL; })>; | ||
beforeRequest?(options: { request: Request; options?: undefined | TOptions; }): void | Request | (RequestInit & { request: Request; }) | (RequestInit & { url: string | URL; request?: undefined | Request; }) | Promise<void | Request | (RequestInit & { request: Request; }) | (RequestInit & { url: string | URL; request?: undefined | Request; })>; | ||
beforeRetry?(options: { | ||
@@ -124,4 +124,4 @@ request: Request; | ||
options?: undefined | TOptions; | ||
}): void | Request | Stop | (RequestInit & { url: string | URL; }) | Promise<void | Request | Stop | (RequestInit & { url: string | URL; })>; | ||
afterResponse?(options: { request: Request; response: Response; options?: undefined | TOptions; }): void | Response | (ResponseInit & { body?: undefined | null | BodyInit; }) | Promise<void | Response | (ResponseInit & { body?: undefined | null | BodyInit; })>; | ||
}): void | Request | Stop | (RequestInit & { request: Request; }) | (RequestInit & { url: string | URL; request?: undefined | Request; }) | Promise<void | Request | Stop | (RequestInit & { request: Request; }) | (RequestInit & { url: string | URL; request?: undefined | Request; })>; | ||
afterResponse?(options: { request: Request; response: Response; options?: undefined | TOptions; }): void | Response | (ResponseInit & { response?: undefined | Response; body?: undefined | null | BodyInit; }) | Promise<void | Response | (ResponseInit & { response?: undefined | Response; body?: undefined | null | BodyInit; })>; | ||
afterError?(options: { request: Request; error: Error; options?: undefined | TOptions; }): void | Error | Promise<void | Error>; | ||
@@ -128,0 +128,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44299
356
+ Added@applitools/utils@1.3.35(transitive)
- Removed@applitools/utils@1.3.34(transitive)
Updated@applitools/utils@1.3.35