getta 1.0.11 → 1.0.12
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/production.analysis.txt +14 -14
- package/dist/types/cjs/main.d.cts.map +1 -1
- package/dist/types/esm/main.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/main.ts +7 -9
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -219,7 +219,7 @@ export class Getta {
|
|
|
219
219
|
context.startTime = this._performance.now();
|
|
220
220
|
|
|
221
221
|
try {
|
|
222
|
-
const {
|
|
222
|
+
const { redirects, retries, ...rest } = options;
|
|
223
223
|
|
|
224
224
|
return await new Promise<FetchResponse>((resolve, reject) => {
|
|
225
225
|
void (async () => {
|
|
@@ -240,11 +240,11 @@ export class Getta {
|
|
|
240
240
|
if (!redirects && !retries) {
|
|
241
241
|
this._log?.(consts.REQUEST_SENT, {
|
|
242
242
|
context: {
|
|
243
|
+
fetchMethod: rest.method,
|
|
243
244
|
fetchRedirets: redirects,
|
|
245
|
+
fetchRequestHeaders: rest.headers,
|
|
244
246
|
fetchRetries: retries,
|
|
245
247
|
fetchUrl: endpoint,
|
|
246
|
-
requestHeaders,
|
|
247
|
-
...rest,
|
|
248
248
|
...context,
|
|
249
249
|
},
|
|
250
250
|
stats: { startTime: context.startTime },
|
|
@@ -253,7 +253,7 @@ export class Getta {
|
|
|
253
253
|
|
|
254
254
|
// Casting as fetch response does not support generics.
|
|
255
255
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
256
|
-
const res = (await fetch(endpoint,
|
|
256
|
+
const res = (await fetch(endpoint, rest)) as FetchResponse;
|
|
257
257
|
|
|
258
258
|
clearTimeout(fetchTimer);
|
|
259
259
|
|
|
@@ -268,7 +268,6 @@ export class Getta {
|
|
|
268
268
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
269
269
|
headers.get(consts.LOCATION_HEADER)!,
|
|
270
270
|
{
|
|
271
|
-
headers: requestHeaders,
|
|
272
271
|
redirects,
|
|
273
272
|
status,
|
|
274
273
|
...rest,
|
|
@@ -286,7 +285,6 @@ export class Getta {
|
|
|
286
285
|
res,
|
|
287
286
|
endpoint,
|
|
288
287
|
{
|
|
289
|
-
headers: requestHeaders,
|
|
290
288
|
retries,
|
|
291
289
|
...rest,
|
|
292
290
|
},
|
|
@@ -461,12 +459,12 @@ export class Getta {
|
|
|
461
459
|
|
|
462
460
|
this._log?.(consts.RESPONSE_RECEIVED, {
|
|
463
461
|
context: {
|
|
462
|
+
fetchMethod: method,
|
|
464
463
|
fetchRedirects: redirects,
|
|
464
|
+
fetchResponseHeaders: headers,
|
|
465
|
+
fetchResponseStatus: status,
|
|
465
466
|
fetchRetries: retries,
|
|
466
467
|
fetchUrl: endpoint,
|
|
467
|
-
method,
|
|
468
|
-
responseHeaders: headers,
|
|
469
|
-
status,
|
|
470
468
|
...otherContext,
|
|
471
469
|
},
|
|
472
470
|
stats: { duration, endTime, startTime },
|