@azure/core-client 1.7.1-alpha.20230106.1 → 1.7.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/dist/index.js CHANGED
@@ -315,13 +315,14 @@ class SerializerImpl {
315
315
  * @returns A valid deserialized Javascript object
316
316
  */
317
317
  deserialize(mapper, responseBody, objectName, options = { xml: {} }) {
318
- var _a, _b, _c;
318
+ var _a, _b, _c, _d;
319
319
  const updatedOptions = {
320
320
  xml: {
321
321
  rootName: (_a = options.xml.rootName) !== null && _a !== void 0 ? _a : "",
322
322
  includeRoot: (_b = options.xml.includeRoot) !== null && _b !== void 0 ? _b : false,
323
323
  xmlCharKey: (_c = options.xml.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
324
324
  },
325
+ ignoreUnknownProperties: (_d = options.ignoreUnknownProperties) !== null && _d !== void 0 ? _d : false,
325
326
  };
326
327
  if (responseBody === undefined || responseBody === null) {
327
328
  if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
@@ -941,7 +942,7 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
941
942
  }
942
943
  }
943
944
  }
944
- else if (responseBody) {
945
+ else if (responseBody && !options.ignoreUnknownProperties) {
945
946
  for (const key of Object.keys(responseBody)) {
946
947
  if (instance[key] === undefined &&
947
948
  !handledPropertyNames.includes(key) &&
@@ -1272,7 +1273,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
1272
1273
  parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
1273
1274
  }
1274
1275
  if (responseSpec.headersMapper) {
1275
- parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders");
1276
+ parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders", { xml: {}, ignoreUnknownProperties: true });
1276
1277
  }
1277
1278
  }
1278
1279
  return parsedResponse;