@microsoft/m365-spec-parser 0.2.2-alpha.8020c3125.0 → 0.2.2-alpha.882a28541.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.
@@ -260,23 +260,28 @@ class Utils {
260
260
  return str.charAt(0).toUpperCase() + str.slice(1);
261
261
  }
262
262
  static getResponseJson(operationObject, allowMultipleMediaType = false) {
263
- var _a, _b;
263
+ var _a;
264
264
  let json = {};
265
265
  let multipleMediaType = false;
266
266
  for (const code of ConstantString.ResponseCodeFor20X) {
267
267
  const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
268
- if ((_b = responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) === null || _b === void 0 ? void 0 : _b["application/json"]) {
269
- multipleMediaType = false;
270
- json = responseObject.content["application/json"];
271
- if (Utils.containMultipleMediaTypes(responseObject)) {
272
- multipleMediaType = true;
273
- if (!allowMultipleMediaType) {
274
- json = {};
268
+ if (responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) {
269
+ for (const contentType of Object.keys(responseObject.content)) {
270
+ // json media type can also be "application/json; charset=utf-8"
271
+ if (contentType.indexOf("application/json") >= 0) {
272
+ multipleMediaType = false;
273
+ json = responseObject.content[contentType];
274
+ if (Utils.containMultipleMediaTypes(responseObject)) {
275
+ multipleMediaType = true;
276
+ if (!allowMultipleMediaType) {
277
+ json = {};
278
+ }
279
+ }
280
+ else {
281
+ return { json, multipleMediaType };
282
+ }
275
283
  }
276
284
  }
277
- else {
278
- break;
279
- }
280
285
  }
281
286
  }
282
287
  return { json, multipleMediaType };
@@ -550,10 +555,11 @@ class Utils {
550
555
  currentCount += items.length;
551
556
  }
552
557
  else {
553
- if (currentCount < maxCount) {
554
- result.push(element);
555
- currentCount++;
556
- }
558
+ result.push(element);
559
+ currentCount++;
560
+ }
561
+ if (currentCount >= maxCount) {
562
+ break;
557
563
  }
558
564
  }
559
565
  return result;