@dynatrace-sdk/http-client 1.3.0 → 1.3.1

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,13 @@
2
2
 
3
3
  @dynatrace-sdk/http-client
4
4
 
5
+ ## 1.3.1
6
+
7
+ ### Patch Changes
8
+
9
+ - Fix JSDoc annotations.
10
+ - The errorCode field in serialized error details is now set using proper errorCode from response instead of status code.
11
+
5
12
  ## 1.3.0
6
13
 
7
14
  ### Minor Changes
package/cjs/index.js CHANGED
@@ -684,7 +684,7 @@ async function parseResponse(response) {
684
684
  return {
685
685
  message: getMessageFromObject(jsonBody.error) || getMessageFromObject(jsonBody) || consumedBody.substring(0, 100),
686
686
  body: jsonBody,
687
- errorCode: jsonBody.error?.code,
687
+ errorCode: jsonBody.error?.details?.errorCode,
688
688
  errorRef: jsonBody.error?.details?.errorRef,
689
689
  traceId: jsonBody.error?.details?.traceId
690
690
  };
package/docs/DOCS.md CHANGED
@@ -15,7 +15,7 @@ import NpmLogo from '@site/static/img/npm-logo.png';
15
15
  <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client" target="_blank" rel="noopener noreferrer"> <span class="margin-right--xs">@dynatrace-sdk/http-client</span> <img className="no-zoom" width="20px" src={NpmLogo} /> </a>
16
16
  </div>
17
17
  <div class="col" style={{textAlign: 'right'}}>
18
- <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.3.0" target="_blank" rel="noopener noreferrer">v1.3.0</a>
18
+ <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.3.1" target="_blank" rel="noopener noreferrer">v1.3.1</a>
19
19
  </div>
20
20
  </div>
21
21
 
package/esm/index.js CHANGED
@@ -647,7 +647,7 @@ async function parseResponse(response) {
647
647
  return {
648
648
  message: getMessageFromObject(jsonBody.error) || getMessageFromObject(jsonBody) || consumedBody.substring(0, 100),
649
649
  body: jsonBody,
650
- errorCode: jsonBody.error?.code,
650
+ errorCode: jsonBody.error?.details?.errorCode,
651
651
  errorRef: jsonBody.error?.details?.errorRef,
652
652
  traceId: jsonBody.error?.details?.traceId
653
653
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/http-client",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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": {
@@ -8,8 +8,8 @@ export interface Binary {
8
8
  *
9
9
  * @param type The type of the data.
10
10
  * Can be `text`, `json`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`.
11
- * @throws DataTypeError when the data does not conform to the specified type.
12
- * @throws UnsupportedOperationError when the type is not supported by the platform.
11
+ * @throws {DataTypeError} Data does not conform to the specified type.
12
+ * @throws {UnsupportedOperationError} Type is not supported by the platform.
13
13
  */
14
14
  get<T extends keyof DataTypes>(type: T): DataTypes[T];
15
15
  }
@@ -26,8 +26,8 @@ export interface HttpClientResponse {
26
26
  * @param responseBodyType The type of the response body.
27
27
  * Can be `text`, `json`, `binary`, `form-data`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`.
28
28
  * The default response body type is `json`.
29
- * @throws DataTypeError when the response body does not conform to the specified response body type.
30
- * @throws UnsupportedOperationError when the response body type is not supported by the platform.
29
+ * @throws {DataTypeError} Response body does not conform to the specified response body type.
30
+ * @throws {UnsupportedOperationError} Response body type is not supported by the platform.
31
31
  */
32
32
  body<T extends keyof ResponseBodyTypes = 'json'>(responseBodyType?: T): ResponseBodyTypes[T];
33
33
  }