@stoplight/elements-core 9.0.1 → 9.0.2

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/index.esm.js CHANGED
@@ -693,6 +693,7 @@ const persistAtom = (key, atomInstance) => {
693
693
  };
694
694
 
695
695
  const convertRequestToSample = (language, library, request) => __awaiter(void 0, void 0, void 0, function* () {
696
+ var _a;
696
697
  if (!isValidTargetId(language))
697
698
  return null;
698
699
  try {
@@ -706,6 +707,12 @@ const convertRequestToSample = (language, library, request) => __awaiter(void 0,
706
707
  }
707
708
  if (typeof converted === 'string') {
708
709
  converted = converted.replace(/%7B/g, '{').replace(/%7D/g, '}');
710
+ if (language === 'shell' && library === 'curl') {
711
+ const isUrlEncoded = (_a = request === null || request === void 0 ? void 0 : request.headers) === null || _a === void 0 ? void 0 : _a.some(header => header.name.toLowerCase() === 'content-type' && header.value === 'application/x-www-form-urlencoded');
712
+ if (isUrlEncoded) {
713
+ converted = converted.replace(/--data\b/g, '--data-urlencode');
714
+ }
715
+ }
709
716
  }
710
717
  return converted;
711
718
  }
package/index.js CHANGED
@@ -715,6 +715,7 @@ const persistAtom = (key, atomInstance) => {
715
715
  };
716
716
 
717
717
  const convertRequestToSample = (language, library, request) => tslib.__awaiter(void 0, void 0, void 0, function* () {
718
+ var _a;
718
719
  if (!httpsnippetLite.isValidTargetId(language))
719
720
  return null;
720
721
  try {
@@ -728,6 +729,12 @@ const convertRequestToSample = (language, library, request) => tslib.__awaiter(v
728
729
  }
729
730
  if (typeof converted === 'string') {
730
731
  converted = converted.replace(/%7B/g, '{').replace(/%7D/g, '}');
732
+ if (language === 'shell' && library === 'curl') {
733
+ const isUrlEncoded = (_a = request === null || request === void 0 ? void 0 : request.headers) === null || _a === void 0 ? void 0 : _a.some(header => header.name.toLowerCase() === 'content-type' && header.value === 'application/x-www-form-urlencoded');
734
+ if (isUrlEncoded) {
735
+ converted = converted.replace(/--data\b/g, '--data-urlencode');
736
+ }
737
+ }
731
738
  }
732
739
  return converted;
733
740
  }
package/index.mjs CHANGED
@@ -693,6 +693,7 @@ const persistAtom = (key, atomInstance) => {
693
693
  };
694
694
 
695
695
  const convertRequestToSample = (language, library, request) => __awaiter(void 0, void 0, void 0, function* () {
696
+ var _a;
696
697
  if (!isValidTargetId(language))
697
698
  return null;
698
699
  try {
@@ -706,6 +707,12 @@ const convertRequestToSample = (language, library, request) => __awaiter(void 0,
706
707
  }
707
708
  if (typeof converted === 'string') {
708
709
  converted = converted.replace(/%7B/g, '{').replace(/%7D/g, '}');
710
+ if (language === 'shell' && library === 'curl') {
711
+ const isUrlEncoded = (_a = request === null || request === void 0 ? void 0 : request.headers) === null || _a === void 0 ? void 0 : _a.some(header => header.name.toLowerCase() === 'content-type' && header.value === 'application/x-www-form-urlencoded');
712
+ if (isUrlEncoded) {
713
+ converted = converted.replace(/--data\b/g, '--data-urlencode');
714
+ }
715
+ }
709
716
  }
710
717
  return converted;
711
718
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",