getta 1.0.12 → 1.0.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "getta",
3
3
  "description": "An isomorphic rest client based on the Fetch API.",
4
- "version": "1.0.12",
4
+ "version": "1.0.14",
5
5
  "author": "Dylan Aubrey",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/getta",
package/src/main.ts CHANGED
@@ -245,6 +245,7 @@ export class Getta {
245
245
  fetchRequestHeaders: rest.headers,
246
246
  fetchRetries: retries,
247
247
  fetchUrl: endpoint,
248
+ logEntryName: 'FETCH_REQUEST_SENT',
248
249
  ...context,
249
250
  },
250
251
  stats: { startTime: context.startTime },
@@ -319,7 +320,7 @@ export class Getta {
319
320
  const endTime = this._performance.now();
320
321
 
321
322
  this._log?.(consts.REQUEST_FAILED, {
322
- context: { error, fetchUrl: endpoint, ...rest },
323
+ context: { error, fetchUrl: endpoint, logEntryName: 'FETCH_REQUEST_FAILED', ...rest },
323
324
  stats: { duration: startTime ? endTime - startTime : 0, endTime, startTime },
324
325
  });
325
326
 
@@ -385,8 +386,10 @@ export class Getta {
385
386
 
386
387
  this._log?.(consts.RESPONSE_FROM_CACHE, {
387
388
  context: {
388
- headers: newHeaders,
389
- url: endpoint,
389
+ fetchMethod: consts.GET_METHOD,
390
+ fetchResponseHeaders: newHeaders,
391
+ fetchUrl: endpoint,
392
+ logEntryName: 'FETCH_RESPONSE_FROM_CACHE',
390
393
  ...context,
391
394
  },
392
395
  });
@@ -461,10 +464,11 @@ export class Getta {
461
464
  context: {
462
465
  fetchMethod: method,
463
466
  fetchRedirects: redirects,
464
- fetchResponseHeaders: headers,
467
+ fetchResponseHeaders: Object.fromEntries(headers.entries()),
465
468
  fetchResponseStatus: status,
466
469
  fetchRetries: retries,
467
470
  fetchUrl: endpoint,
471
+ logEntryName: 'FETCH_RESPONSE_RECEIVED',
468
472
  ...otherContext,
469
473
  },
470
474
  stats: { duration, endTime, startTime },