@microsoft/m365-spec-parser 0.2.2-alpha.7d5be6034.0 → 0.2.2-alpha.9389d4dc7.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.
@@ -302,23 +302,28 @@ class Utils {
302
302
  return str.charAt(0).toUpperCase() + str.slice(1);
303
303
  }
304
304
  static getResponseJson(operationObject, allowMultipleMediaType = false) {
305
- var _a, _b;
305
+ var _a;
306
306
  let json = {};
307
307
  let multipleMediaType = false;
308
308
  for (const code of ConstantString.ResponseCodeFor20X) {
309
309
  const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
310
- if ((_b = responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) === null || _b === void 0 ? void 0 : _b["application/json"]) {
311
- multipleMediaType = false;
312
- json = responseObject.content["application/json"];
313
- if (Utils.containMultipleMediaTypes(responseObject)) {
314
- multipleMediaType = true;
315
- if (!allowMultipleMediaType) {
316
- json = {};
310
+ if (responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) {
311
+ for (const contentType of Object.keys(responseObject.content)) {
312
+ // json media type can also be "application/json; charset=utf-8"
313
+ if (contentType.indexOf("application/json") >= 0) {
314
+ multipleMediaType = false;
315
+ json = responseObject.content[contentType];
316
+ if (Utils.containMultipleMediaTypes(responseObject)) {
317
+ multipleMediaType = true;
318
+ if (!allowMultipleMediaType) {
319
+ json = {};
320
+ }
321
+ }
322
+ else {
323
+ return { json, multipleMediaType };
324
+ }
317
325
  }
318
326
  }
319
- else {
320
- break;
321
- }
322
327
  }
323
328
  }
324
329
  return { json, multipleMediaType };
@@ -592,10 +597,11 @@ class Utils {
592
597
  currentCount += items.length;
593
598
  }
594
599
  else {
595
- if (currentCount < maxCount) {
596
- result.push(element);
597
- currentCount++;
598
- }
600
+ result.push(element);
601
+ currentCount++;
602
+ }
603
+ if (currentCount >= maxCount) {
604
+ break;
599
605
  }
600
606
  }
601
607
  return result;