@dynatrace-sdk/http-client 1.0.6 → 1.0.8

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  @dynatrace-sdk/http-client
4
4
 
5
+ ## 1.0.8
6
+
7
+ ### Patch Changes
8
+
9
+ - Add optional `traceId` to `SerializedError`.
10
+ - Updated dependencies
11
+
12
+ - @dynatrace-sdk/error-handlers@1.2.0
13
+
14
+ ## 1.0.7
15
+
16
+ ### Patch Changes
17
+
18
+ - Update docs
19
+
5
20
  ## 1.0.6
6
21
 
7
22
  ### Patch Changes
package/cjs/index.js CHANGED
@@ -438,7 +438,8 @@ async function parseResponse(response) {
438
438
  return {
439
439
  message: getMessageFromObject(jsonBody.error) || getMessageFromObject(jsonBody) || consumedBody.substring(0, 100),
440
440
  body: jsonBody,
441
- errorRef: jsonBody.error?.details?.errorRef
441
+ errorRef: jsonBody.error?.details?.errorRef,
442
+ traceId: jsonBody.error?.details?.traceId
442
443
  };
443
444
  } else {
444
445
  return {
@@ -456,8 +457,9 @@ async function parseResponse(response) {
456
457
  var httpClientResponseErrorSerializer = async (error) => {
457
458
  if (error instanceof HttpClientResponseError) {
458
459
  const status = error.response.status;
459
- const { message, body, errorRef } = await parseResponse(error.response);
460
+ const { message, body, errorRef, traceId } = await parseResponse(error.response);
460
461
  const optionalErrorRef = errorRef ? { errorRef } : {};
462
+ const optionalTraceId = traceId ? { traceId } : {};
461
463
  return {
462
464
  name: error.name,
463
465
  status,
@@ -465,7 +467,8 @@ var httpClientResponseErrorSerializer = async (error) => {
465
467
  stack: error.stack,
466
468
  type: import_error_handlers.ErrorType.HTTP,
467
469
  body,
468
- ...optionalErrorRef
470
+ ...optionalErrorRef,
471
+ ...optionalTraceId
469
472
  };
470
473
  }
471
474
  };
package/docs/DOCS.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: @dynatrace-sdk/http-client
2
+ title: "@dynatrace-sdk/http-client"
3
3
  description: An environment agnostic (browser/deno vs nodejs) abstraction layer for making HTTP calls.
4
4
  ---
5
5
 
@@ -17,7 +17,7 @@ import NpmLogo from '@site/static/img/npm-logo.png';
17
17
  </a>
18
18
  </div>
19
19
  <div class="col" style={{textAlign: 'right'}}>
20
- <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.0.6">v1.0.6</a>
20
+ <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.0.8">v1.0.8</a>
21
21
  </div>
22
22
  </div>
23
23
 
@@ -226,7 +226,7 @@ when one of the following situations happen:
226
226
 
227
227
  #### Returns
228
228
 
229
- Promise<HttpClientResponse> A promise that resolves with the response object or rejects with an error.
229
+ Promise&lt;HttpClientResponse&gt; A promise that resolves with the response object or rejects with an error.
230
230
 
231
231
  </div>
232
232
 
@@ -621,7 +621,7 @@ when one of the following situations happen:
621
621
 
622
622
  #### Returns
623
623
 
624
- Promise<HttpClientResponse> A promise that resolves with the response object or rejects with an error.
624
+ Promise&lt;HttpClientResponse&gt; A promise that resolves with the response object or rejects with an error.
625
625
 
626
626
  </div>
627
627
 
package/esm/index.js CHANGED
@@ -406,7 +406,8 @@ async function parseResponse(response) {
406
406
  return {
407
407
  message: getMessageFromObject(jsonBody.error) || getMessageFromObject(jsonBody) || consumedBody.substring(0, 100),
408
408
  body: jsonBody,
409
- errorRef: jsonBody.error?.details?.errorRef
409
+ errorRef: jsonBody.error?.details?.errorRef,
410
+ traceId: jsonBody.error?.details?.traceId
410
411
  };
411
412
  } else {
412
413
  return {
@@ -424,8 +425,9 @@ async function parseResponse(response) {
424
425
  var httpClientResponseErrorSerializer = async (error) => {
425
426
  if (error instanceof HttpClientResponseError) {
426
427
  const status = error.response.status;
427
- const { message, body, errorRef } = await parseResponse(error.response);
428
+ const { message, body, errorRef, traceId } = await parseResponse(error.response);
428
429
  const optionalErrorRef = errorRef ? { errorRef } : {};
430
+ const optionalTraceId = traceId ? { traceId } : {};
429
431
  return {
430
432
  name: error.name,
431
433
  status,
@@ -433,7 +435,8 @@ var httpClientResponseErrorSerializer = async (error) => {
433
435
  stack: error.stack,
434
436
  type: ErrorType.HTTP,
435
437
  body,
436
- ...optionalErrorRef
438
+ ...optionalErrorRef,
439
+ ...optionalTraceId
437
440
  };
438
441
  }
439
442
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/http-client",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "An environment agnostic (browser/deno vs nodejs) abstraction layer for making HTTP calls.",
5
5
  "license": "Apache-2.0",
6
6
  "dependencies": {
7
- "@dynatrace-sdk/error-handlers": "^1.1.0"
7
+ "@dynatrace-sdk/error-handlers": "^1.2.0"
8
8
  },
9
9
  "main": "./cjs/index.js",
10
10
  "module": "./esm/index.js",