@azure/core-client 1.2.2-alpha.20210713.1 → 1.3.0

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
@@ -1,15 +1,20 @@
1
1
  # Release History
2
2
 
3
- ## 1.2.2 (Unreleased)
3
+ ## 1.3.0 (2021-08-04)
4
4
 
5
5
  ### Features Added
6
6
 
7
- ### Breaking Changes
7
+ - Updated to use version 1.0.0-preview.13 of `@azure/core-tracing`.
8
8
 
9
9
  ### Key Bugs Fixed
10
10
 
11
- ### Fixed
11
+ - Fixed an issue where APIs that accepted a Blob didn't work with File objects. See [#16754](https://github.com/Azure/azure-sdk-for-js/issues/16754) for more details.
12
+
13
+ ## 1.2.2 (2021-07-13)
14
+
15
+ ### Key Bugs Fixed
12
16
 
17
+ - Fixed the return value during the flattening the response for `HEAD` HTTP Requests. This will ensure that the return value will indicate the presence/absence of the resource. Please refer [#1037](https://github.com/Azure/autorest.typescript/issues/1037) for more details.
13
18
 
14
19
  ## 1.2.1 (2021-06-30)
15
20
 
package/dist/index.js CHANGED
@@ -78,12 +78,10 @@ function handleNullableResponseAndWrappableBody(responseObject) {
78
78
  function flattenResponse(fullResponse, responseSpec) {
79
79
  var _a, _b;
80
80
  const parsedHeaders = fullResponse.parsedHeaders;
81
- /**
82
- * If body is not asked for, only response headers are returned. If the response
83
- * has a body anyway, that body must be ignored.
84
- */
81
+ // head methods never have a body, but we return a boolean set to body property
82
+ // to indicate presence/absence of the resource
85
83
  if (fullResponse.request.method === "HEAD") {
86
- return parsedHeaders;
84
+ return Object.assign(Object.assign({}, parsedHeaders), { body: fullResponse.parsedBody });
87
85
  }
88
86
  const bodyMapper = responseSpec && responseSpec.bodyMapper;
89
87
  const isNullable = Boolean(bodyMapper === null || bodyMapper === void 0 ? void 0 : bodyMapper.nullable);
@@ -470,7 +468,6 @@ function unixTimeToDate(n) {
470
468
  return new Date(n * 1000);
471
469
  }
472
470
  function serializeBasicTypes(typeName, objectName, value) {
473
- var _a;
474
471
  if (value !== null && value !== undefined) {
475
472
  if (typeName.match(/^Number$/i) !== null) {
476
473
  if (typeof value !== "number") {
@@ -498,7 +495,8 @@ function serializeBasicTypes(typeName, objectName, value) {
498
495
  typeof value.pipe !== "function" &&
499
496
  !(value instanceof ArrayBuffer) &&
500
497
  !ArrayBuffer.isView(value) &&
501
- !(((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) === "Blob")) {
498
+ // File objects count as a type of Blob, so we want to use instanceof explicitly
499
+ !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) {
502
500
  throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or NodeJS.ReadableStream.`);
503
501
  }
504
502
  }