getta 1.0.11 → 1.0.13
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 +10 -10
- 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 +10 -10
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,12 @@ 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
|
-
|
|
247
|
-
...rest,
|
|
248
|
+
logEntryName: 'FETCH_REQUEST_SENT',
|
|
248
249
|
...context,
|
|
249
250
|
},
|
|
250
251
|
stats: { startTime: context.startTime },
|
|
@@ -253,7 +254,7 @@ export class Getta {
|
|
|
253
254
|
|
|
254
255
|
// Casting as fetch response does not support generics.
|
|
255
256
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
256
|
-
const res = (await fetch(endpoint,
|
|
257
|
+
const res = (await fetch(endpoint, rest)) as FetchResponse;
|
|
257
258
|
|
|
258
259
|
clearTimeout(fetchTimer);
|
|
259
260
|
|
|
@@ -268,7 +269,6 @@ export class Getta {
|
|
|
268
269
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
269
270
|
headers.get(consts.LOCATION_HEADER)!,
|
|
270
271
|
{
|
|
271
|
-
headers: requestHeaders,
|
|
272
272
|
redirects,
|
|
273
273
|
status,
|
|
274
274
|
...rest,
|
|
@@ -286,7 +286,6 @@ export class Getta {
|
|
|
286
286
|
res,
|
|
287
287
|
endpoint,
|
|
288
288
|
{
|
|
289
|
-
headers: requestHeaders,
|
|
290
289
|
retries,
|
|
291
290
|
...rest,
|
|
292
291
|
},
|
|
@@ -321,7 +320,7 @@ export class Getta {
|
|
|
321
320
|
const endTime = this._performance.now();
|
|
322
321
|
|
|
323
322
|
this._log?.(consts.REQUEST_FAILED, {
|
|
324
|
-
context: { error, fetchUrl: endpoint, ...rest },
|
|
323
|
+
context: { error, fetchUrl: endpoint, logEntryName: 'FETCH_REQUEST_FAILED', ...rest },
|
|
325
324
|
stats: { duration: startTime ? endTime - startTime : 0, endTime, startTime },
|
|
326
325
|
});
|
|
327
326
|
|
|
@@ -461,12 +460,13 @@ export class Getta {
|
|
|
461
460
|
|
|
462
461
|
this._log?.(consts.RESPONSE_RECEIVED, {
|
|
463
462
|
context: {
|
|
463
|
+
fetchMethod: method,
|
|
464
464
|
fetchRedirects: redirects,
|
|
465
|
+
fetchResponseHeaders: Object.fromEntries(headers.entries()),
|
|
466
|
+
fetchResponseStatus: status,
|
|
465
467
|
fetchRetries: retries,
|
|
466
468
|
fetchUrl: endpoint,
|
|
467
|
-
|
|
468
|
-
responseHeaders: headers,
|
|
469
|
-
status,
|
|
469
|
+
logEntryName: 'FETCH_RESPONSE_RECEIVED',
|
|
470
470
|
...otherContext,
|
|
471
471
|
},
|
|
472
472
|
stats: { duration, endTime, startTime },
|