@readme/httpsnippet 11.0.0 → 11.1.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.
@@ -14,5 +14,5 @@ var reducer = (accumulator, pair) => {
14
14
  };
15
15
 
16
16
  export { reducer };
17
- //# sourceMappingURL=chunk-KT7MO6Z4.js.map
18
- //# sourceMappingURL=chunk-KT7MO6Z4.js.map
17
+ //# sourceMappingURL=chunk-LCVMSGCB.js.map
18
+ //# sourceMappingURL=chunk-LCVMSGCB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,OAAA,GAAU,CACrB,WAAA,EACA,IAAA,KACwB;AACxB,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AAC1C,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA,GAAI,IAAA,CAAK,KAAA;AAC9B,IAAA,OAAO,WAAA;AAAA;AAIT,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,EAAG;AAC/B,IAAA,YAAA,CAAa,IAAA,CAAK,KAAK,KAAK,CAAA;AAC5B,IAAA,OAAO,WAAA;AAAA;AAIT,EAAA,WAAA,CAAY,KAAK,IAAI,CAAA,GAAI,CAAC,YAAA,EAAc,KAAK,KAAK,CAAA;AAClD,EAAA,OAAO,WAAA;AACT","file":"chunk-LCVMSGCB.js","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(\n accumulator: ReducedHelperObject,\n pair: T,\n): ReducedHelperObject => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/code-builder.ts"],"names":[],"mappings":";;;AAAA,IAAM,6BAAgC,GAAA,EAAA,CAAA;AACtC,IAAM,iBAAoB,GAAA,IAAA,CAAA;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,MAAA,EAAQ,IAAK,EAAA,GAAwB,EAAI,EAAA;AAZvD,IAAA,IAAA,CAAA,cAAA,GAAkC,EAAC,CAAA;AAEnC,IAAA,IAAA,CAAA,IAAA,GAAiB,EAAC,CAAA;AAElB,IAA+B,IAAA,CAAA,oBAAA,GAAA,6BAAA,CAAA;AAE/B,IAAW,IAAA,CAAA,QAAA,GAAA,iBAAA,CAAA;AAcX;AAAA;AAAA;AAAA,IAAa,IAAA,CAAA,UAAA,GAAA,CAAC,IAAc,EAAA,gBAAA,GAAmB,CAAM,KAAA;AACnD,MAAA,MAAM,MAAS,GAAA,IAAA,CAAK,oBAAqB,CAAA,MAAA,CAAO,gBAAgB,CAAA,CAAA;AAChE,MAAO,OAAA,CAAA,EAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA,CAAA;AAAA,KACzB,CAAA;AAKA;AAAA;AAAA;AAAA,IAAU,IAAA,CAAA,OAAA,GAAA,CAAC,MAAc,gBAA8B,KAAA;AACrD,MAAA,MAAM,OAAU,GAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,gBAAgB,CAAA,CAAA;AACtD,MAAK,IAAA,CAAA,IAAA,CAAK,QAAQ,OAAO,CAAA,CAAA;AAAA,KAC3B,CAAA;AAKA;AAAA;AAAA;AAAA,IAAO,IAAA,CAAA,IAAA,GAAA,CAAC,MAAc,gBAA8B,KAAA;AAClD,MAAA,MAAM,OAAU,GAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,gBAAgB,CAAA,CAAA;AACtD,MAAK,IAAA,CAAA,IAAA,CAAK,KAAK,OAAO,CAAA,CAAA;AAAA,KACxB,CAAA;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,KAAA,GAAQ,MAAM;AACZ,MAAK,IAAA,CAAA,IAAA,CAAK,KAAK,EAAE,CAAA,CAAA;AAAA,KACnB,CAAA;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,IAAA,GAAO,MAAM;AACX,MAAA,MAAM,cAAiB,GAAA,IAAA,CAAK,IAAK,CAAA,IAAA,CAAK,KAAK,QAAQ,CAAA,CAAA;AACnD,MAAM,MAAA,cAAA,GAAiB,IAAK,CAAA,cAAA,CAAe,MAAO,CAAA,CAAC,aAAa,QAAa,KAAA,QAAA,CAAS,WAAW,CAAA,EAAG,cAAc,CAAA,CAAA;AAClH,MAAO,OAAA,cAAA,CAAA;AAAA,KACT,CAAA;AAMA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,gBAAA,GAAmB,CAAC,aAAiC,KAAA;AACnD,MAAA,IAAA,CAAK,cAAiB,GAAA,CAAC,GAAG,IAAA,CAAK,gBAAgB,aAAa,CAAA,CAAA;AAAA,KAC9D,CAAA;AAlDE,IAAA,IAAA,CAAK,uBAAuB,MAAU,IAAA,6BAAA,CAAA;AACtC,IAAA,IAAA,CAAK,WAAW,IAAQ,IAAA,iBAAA,CAAA;AAAA,GAC1B;AAiDF","file":"code-builder.cjs","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/helpers/code-builder.ts"],"names":[],"mappings":";;;AAAA,IAAM,6BAAA,GAAgC,EAAA;AACtC,IAAM,iBAAA,GAAoB,IAAA;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,MAAA,EAAQ,IAAA,EAAK,GAAwB,EAAC,EAAG;AAZvD,IAAA,IAAA,CAAA,cAAA,GAAkC,EAAC;AAEnC,IAAA,IAAA,CAAA,IAAA,GAAiB,EAAC;AAElB,IAAA,IAAA,CAAA,oBAAA,GAA+B,6BAAA;AAE/B,IAAA,IAAA,CAAA,QAAA,GAAmB,iBAAA;AAcnB;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,UAAA,GAAa,CAAC,IAAA,EAAc,gBAAA,GAAmB,CAAA,KAAM;AACnD,MAAA,MAAM,MAAA,GAAS,IAAA,CAAK,oBAAA,CAAqB,MAAA,CAAO,gBAAgB,CAAA;AAChE,MAAA,OAAO,CAAA,EAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,KACzB;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,OAAA,GAAU,CAAC,MAAc,gBAAA,KAAoC;AAC3D,MAAA,MAAM,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,IAAA,EAAM,gBAAgB,CAAA;AACtD,MAAA,IAAA,CAAK,IAAA,CAAK,QAAQ,OAAO,CAAA;AAAA,KAC3B;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,IAAA,GAAO,CAAC,MAAc,gBAAA,KAAoC;AACxD,MAAA,MAAM,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,IAAA,EAAM,gBAAgB,CAAA;AACtD,MAAA,IAAA,CAAK,IAAA,CAAK,KAAK,OAAO,CAAA;AAAA,KACxB;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,KAAA,GAAQ,MAAY;AAClB,MAAA,IAAA,CAAK,IAAA,CAAK,KAAK,EAAE,CAAA;AAAA,KACnB;AAKA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,IAAA,GAAO,MAAc;AACnB,MAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,KAAK,QAAQ,CAAA;AACnD,MAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,cAAA,CAAe,MAAA,CAAO,CAAC,aAAa,QAAA,KAAa,QAAA,CAAS,WAAW,CAAA,EAAG,cAAc,CAAA;AAClH,MAAA,OAAO,cAAA;AAAA,KACT;AAMA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,gBAAA,GAAmB,CAAC,aAAA,KAAuC;AACzD,MAAA,IAAA,CAAK,cAAA,GAAiB,CAAC,GAAG,IAAA,CAAK,gBAAgB,aAAa,CAAA;AAAA,KAC9D;AAlDE,IAAA,IAAA,CAAK,uBAAuB,MAAA,IAAU,6BAAA;AACtC,IAAA,IAAA,CAAK,WAAW,IAAA,IAAQ,iBAAA;AAAA;AAkD5B","file":"code-builder.cjs","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin: string = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number): void => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number): void => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = (): void => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = (): string => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor): void => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
- export { CodeBuilder } from '../chunk-Y7NI4MMY.js';
1
+ export { CodeBuilder } from '../chunk-6B3J3CUI.js';
2
2
  //# sourceMappingURL=code-builder.js.map
3
3
  //# sourceMappingURL=code-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";;;AAEa,IAAA,OAAA,GAAU,CAA4C,WAAA,EAAkC,IAAY,KAAA;AAC/G,EAAM,MAAA,YAAA,GAAe,WAAY,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC1C,EAAA,IAAI,iBAAiB,KAAW,CAAA,EAAA;AAC9B,IAAY,WAAA,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AAC9B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,YAAY,CAAG,EAAA;AAC/B,IAAa,YAAA,CAAA,IAAA,CAAK,KAAK,KAAK,CAAA,CAAA;AAC5B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAA,WAAA,CAAY,KAAK,IAAI,CAAA,GAAI,CAAC,YAAA,EAAc,KAAK,KAAK,CAAA,CAAA;AAClD,EAAO,OAAA,WAAA,CAAA;AACT","file":"reducer.cjs","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
1
+ {"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";;;AAEO,IAAM,OAAA,GAAU,CACrB,WAAA,EACA,IAAA,KACwB;AACxB,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AAC1C,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA,GAAI,IAAA,CAAK,KAAA;AAC9B,IAAA,OAAO,WAAA;AAAA;AAIT,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,EAAG;AAC/B,IAAA,YAAA,CAAa,IAAA,CAAK,KAAK,KAAK,CAAA;AAC5B,IAAA,OAAO,WAAA;AAAA;AAIT,EAAA,WAAA,CAAY,KAAK,IAAI,CAAA,GAAI,CAAC,YAAA,EAAc,KAAK,KAAK,CAAA;AAClD,EAAA,OAAO,WAAA;AACT","file":"reducer.cjs","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(\n accumulator: ReducedHelperObject,\n pair: T,\n): ReducedHelperObject => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
@@ -1,3 +1,3 @@
1
- export { reducer } from '../chunk-KT7MO6Z4.js';
1
+ export { reducer } from '../chunk-LCVMSGCB.js';
2
2
  //# sourceMappingURL=reducer.js.map
3
3
  //# sourceMappingURL=reducer.js.map
package/dist/index.cjs CHANGED
@@ -516,7 +516,7 @@ var restsharp = {
516
516
  link: "http://restsharp.org/",
517
517
  description: "Simple REST and HTTP API Client for .NET",
518
518
  extname: ".cs",
519
- installation: "dotnet add package RestSharp"
519
+ installation: () => "dotnet add package RestSharp"
520
520
  },
521
521
  convert: ({ method, fullUrl, headersObj, cookies, postData, uriObj }) => {
522
522
  const { push, join } = new CodeBuilder();
@@ -925,7 +925,7 @@ var axios = {
925
925
  link: "https://github.com/axios/axios",
926
926
  description: "Promise based HTTP client for the browser and node.js",
927
927
  extname: ".js",
928
- installation: "npm install axios --save"
928
+ installation: () => "npm install axios --save"
929
929
  },
930
930
  convert: ({ allHeaders, method, url, queryObj, postData }, options) => {
931
931
  const opts = {
@@ -1024,7 +1024,7 @@ var fetch = {
1024
1024
  options.body = postData.jsonObj;
1025
1025
  }
1026
1026
  break;
1027
- case "multipart/form-data":
1027
+ case "multipart/form-data": {
1028
1028
  if (!postData.params) {
1029
1029
  break;
1030
1030
  }
@@ -1038,6 +1038,7 @@ var fetch = {
1038
1038
  });
1039
1039
  blank();
1040
1040
  break;
1041
+ }
1041
1042
  default:
1042
1043
  if (postData.text) {
1043
1044
  options.body = postData.text;
@@ -1248,7 +1249,7 @@ var native2 = {
1248
1249
  payload = postData.jsonObj;
1249
1250
  }
1250
1251
  break;
1251
- case "multipart/form-data":
1252
+ case "multipart/form-data": {
1252
1253
  if (!postData.params) {
1253
1254
  break;
1254
1255
  }
@@ -1258,6 +1259,7 @@ var native2 = {
1258
1259
  });
1259
1260
  payload = multipartPayload;
1260
1261
  break;
1262
+ }
1261
1263
  default:
1262
1264
  if (postData.text) {
1263
1265
  payload = postData.text;
@@ -1354,7 +1356,7 @@ var axios2 = {
1354
1356
  link: "https://github.com/axios/axios",
1355
1357
  description: "Promise based HTTP client for the browser and node.js",
1356
1358
  extname: ".js",
1357
- installation: "npm install axios --save"
1359
+ installation: () => "npm install axios --save"
1358
1360
  },
1359
1361
  convert: ({ method, fullUrl, allHeaders, postData }, options) => {
1360
1362
  const opts = {
@@ -1439,7 +1441,7 @@ var fetch2 = {
1439
1441
  reqOpts.body = postData.jsonObj;
1440
1442
  }
1441
1443
  break;
1442
- case "multipart/form-data":
1444
+ case "multipart/form-data": {
1443
1445
  if (!postData.params) {
1444
1446
  break;
1445
1447
  }
@@ -1463,6 +1465,7 @@ var fetch2 = {
1463
1465
  reqOpts.body = "formData";
1464
1466
  blank();
1465
1467
  break;
1468
+ }
1466
1469
  default:
1467
1470
  if (postData.text) {
1468
1471
  reqOpts.body = postData.text;
@@ -1760,7 +1763,7 @@ var cohttp = {
1760
1763
  link: "https://github.com/mirage/ocaml-cohttp",
1761
1764
  description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",
1762
1765
  extname: ".ml",
1763
- installation: "opam install cohttp-lwt-unix cohttp-async"
1766
+ installation: () => "opam install cohttp-lwt-unix cohttp-async"
1764
1767
  },
1765
1768
  convert: ({ fullUrl, allHeaders, postData, method }, options) => {
1766
1769
  const opts = {
@@ -1958,9 +1961,9 @@ var curl = {
1958
1961
  push("curl_setopt_array($curl, [");
1959
1962
  const curlopts = new CodeBuilder({ indent, join: `
1960
1963
  ${indent}` });
1961
- curlOptions.forEach(({ value, name, escape: escape2 }) => {
1964
+ curlOptions.forEach(({ value, name, escape: escape3 }) => {
1962
1965
  if (value !== null && value !== void 0) {
1963
- curlopts.push(`${name} => ${escape2 ? JSON.stringify(value) : value},`);
1966
+ curlopts.push(`${name} => ${escape3 ? JSON.stringify(value) : value},`);
1964
1967
  }
1965
1968
  });
1966
1969
  const curlCookies = cookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`);
@@ -2007,7 +2010,7 @@ var guzzle = {
2007
2010
  link: "http://docs.guzzlephp.org/en/stable/",
2008
2011
  description: "PHP with Guzzle",
2009
2012
  extname: ".php",
2010
- installation: "composer require guzzlehttp/guzzle"
2013
+ installation: () => "composer require guzzlehttp/guzzle"
2011
2014
  },
2012
2015
  convert: ({ postData, fullUrl, method, cookies, headersObj }, options) => {
2013
2016
  const opts = {
@@ -2068,9 +2071,7 @@ var guzzle = {
2068
2071
  requestPush(`'body' => ${convertType(postData.text)},`, 1);
2069
2072
  }
2070
2073
  }
2071
- const headers = Object.keys(headersObj).sort().map(function(key) {
2072
- return `${opts.indent}${opts.indent}'${key}' => '${escapeForSingleQuotes(headersObj[key])}',`;
2073
- });
2074
+ const headers = Object.keys(headersObj).sort().map((key) => `${opts.indent}${opts.indent}'${key}' => '${escapeForSingleQuotes(headersObj[key])}',`);
2074
2075
  const cookieString = cookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`).join("; ");
2075
2076
  if (cookieString.length) {
2076
2077
  headers.push(`${opts.indent}${opts.indent}'cookie' => '${escapeForSingleQuotes(cookieString)}',`);
@@ -2433,7 +2434,7 @@ var requests = {
2433
2434
  link: "http://docs.python-requests.org/en/latest/api/#requests.request",
2434
2435
  description: "Requests HTTP library",
2435
2436
  extname: ".py",
2436
- installation: "python -m pip install requests"
2437
+ installation: () => "python -m pip install requests"
2437
2438
  },
2438
2439
  convert: ({ fullUrl, postData, allHeaders, method }, options) => {
2439
2440
  const opts = {
@@ -2750,7 +2751,7 @@ var quote = (value = "") => {
2750
2751
  }
2751
2752
  return `'${value.replace(/'/g, "'\\''")}'`;
2752
2753
  };
2753
- var escape = (value) => value.replace(/\r/g, "\\r").replace(/\n/g, "\\n");
2754
+ var escape2 = (value) => value.replace(/\r/g, "\\r").replace(/\n/g, "\\n");
2754
2755
 
2755
2756
  // src/targets/shell/curl/client.ts
2756
2757
  var params = {
@@ -2837,18 +2838,16 @@ ${indent}` : " "
2837
2838
  case "application/x-www-form-urlencoded":
2838
2839
  if (postData.params) {
2839
2840
  postData.params.forEach((param) => {
2840
- const unencoded = param.name;
2841
2841
  const encoded = encodeURIComponent(param.name);
2842
- const needsEncoding = encoded !== unencoded;
2843
- const name = needsEncoding ? encoded : unencoded;
2844
- const flag = binary ? "--data-binary" : needsEncoding ? "--data-urlencode" : arg("data");
2842
+ const name = encoded !== param.name ? encoded : param.name;
2843
+ const flag = binary ? "--data-binary" : "--data-urlencode";
2845
2844
  push(`${flag} ${quote(`${name}=${param.value}`)}`);
2846
2845
  });
2847
2846
  } else {
2848
2847
  push(`${binary ? "--data-binary" : arg("data")} ${quote(postData.text)}`);
2849
2848
  }
2850
2849
  break;
2851
- default:
2850
+ default: {
2852
2851
  if (!postData.text) {
2853
2852
  break;
2854
2853
  }
@@ -2875,13 +2874,14 @@ ${JSON.stringify(jsonPayload, null, indentJSON)}
2875
2874
  '`
2876
2875
  );
2877
2876
  }
2878
- } catch (err) {
2877
+ } catch {
2879
2878
  }
2880
2879
  }
2881
2880
  }
2882
2881
  if (!builtPayload) {
2883
2882
  push(`${binary ? "--data-binary" : arg("data")} ${quote(postData.text)}`);
2884
2883
  }
2884
+ }
2885
2885
  }
2886
2886
  return join();
2887
2887
  }
@@ -2895,7 +2895,7 @@ var httpie = {
2895
2895
  link: "http://httpie.org/",
2896
2896
  description: "a CLI, cURL-like tool for humans",
2897
2897
  extname: ".sh",
2898
- installation: "brew install httpie"
2898
+ installation: () => "brew install httpie"
2899
2899
  },
2900
2900
  convert: ({ allHeaders, postData, queryObj, fullUrl, method, url }, options) => {
2901
2901
  const opts = {
@@ -2964,7 +2964,7 @@ ${opts.indent}` : " "
2964
2964
  push(`${key}:${quote(allHeaders[key])}`);
2965
2965
  });
2966
2966
  if (postData.mimeType === "application/x-www-form-urlencoded") {
2967
- if (postData.params && postData.params.length) {
2967
+ if (postData.params?.length) {
2968
2968
  flags.push(opts.short ? "-f" : "--form");
2969
2969
  postData.params.forEach((param) => {
2970
2970
  push(`${param.name}=${quote(param.value)}`);
@@ -3016,7 +3016,7 @@ ${opts.indent}` : " "
3016
3016
  push(`--header ${quote(header)}`);
3017
3017
  });
3018
3018
  if (postData.text) {
3019
- push(`--body-data ${escape(quote(postData.text))}`);
3019
+ push(`--body-data ${escape2(quote(postData.text))}`);
3020
3020
  }
3021
3021
  push(opts.short ? "-O" : "--output-document");
3022
3022
  push(`- ${quote(fullUrl)}`);
@@ -3120,7 +3120,9 @@ var urlsession = {
3120
3120
  const parameters = postData.params.map((p) => `"${p.name}": "${p.value}"`);
3121
3121
  if (opts.pretty) {
3122
3122
  push("let parameters = [");
3123
- parameters.forEach((param) => push(`${param},`, 1));
3123
+ parameters.forEach((param) => {
3124
+ push(`${param},`, 1);
3125
+ });
3124
3126
  push("]");
3125
3127
  } else {
3126
3128
  push(`let parameters = [${parameters.join(", ")}]`);
@@ -3403,10 +3405,10 @@ var HTTPSnippet = class {
3403
3405
  cookiesObj: {},
3404
3406
  allHeaders: {}
3405
3407
  };
3406
- if (request.queryString && request.queryString.length) {
3408
+ if (request?.queryString.length) {
3407
3409
  request.queryObj = request.queryString.reduce(reducer, {});
3408
3410
  }
3409
- if (request.headers && request.headers.length) {
3411
+ if (request?.headers.length) {
3410
3412
  const http2VersionRegex = /^HTTP\/2/;
3411
3413
  request.headersObj = request.headers.reduce((accumulator, { name, value }) => {
3412
3414
  const headerName = http2VersionRegex.exec(request.httpVersion) ? name.toLocaleLowerCase() : name;
@@ -3416,7 +3418,7 @@ var HTTPSnippet = class {
3416
3418
  };
3417
3419
  }, {});
3418
3420
  }
3419
- if (request.cookies && request.cookies.length) {
3421
+ if (request?.cookies.length) {
3420
3422
  request.cookiesObj = request.cookies.reduceRight(
3421
3423
  (accumulator, { name, value }) => ({
3422
3424
  ...accumulator,
@@ -3445,7 +3447,7 @@ var HTTPSnippet = class {
3445
3447
  const boundary = "---011000010111000001101001";
3446
3448
  const carriage = `${boundary}--`;
3447
3449
  const rn = "\r\n";
3448
- const escape2 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
3450
+ const escapeStr = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
3449
3451
  const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, "\r\n");
3450
3452
  const payload = [`--${boundary}`];
3451
3453
  request.postData?.params.forEach((param, i) => {
@@ -3455,11 +3457,11 @@ var HTTPSnippet = class {
3455
3457
  const contentType = param.contentType || "application/octet-stream";
3456
3458
  if (filename) {
3457
3459
  payload.push(
3458
- `Content-Disposition: form-data; name="${escape2(normalizeLinefeeds(name))}"; filename="${filename}"`
3460
+ `Content-Disposition: form-data; name="${escapeStr(normalizeLinefeeds(name))}"; filename="${filename}"`
3459
3461
  );
3460
3462
  payload.push(`Content-Type: ${contentType}`);
3461
3463
  } else {
3462
- payload.push(`Content-Disposition: form-data; name="${escape2(normalizeLinefeeds(name))}"`);
3464
+ payload.push(`Content-Disposition: form-data; name="${escape(normalizeLinefeeds(name))}"`);
3463
3465
  }
3464
3466
  payload.push("");
3465
3467
  payload.push(normalizeLinefeeds(value));
@@ -3490,7 +3492,7 @@ var HTTPSnippet = class {
3490
3492
  if (request.postData.text) {
3491
3493
  try {
3492
3494
  request.postData.jsonObj = JSON.parse(request.postData.text);
3493
- } catch (e) {
3495
+ } catch {
3494
3496
  request.postData.mimeType = "text/plain";
3495
3497
  }
3496
3498
  }
@@ -3544,16 +3546,31 @@ var HTTPSnippet = class {
3544
3546
  this.init();
3545
3547
  }
3546
3548
  if (!options && clientId) {
3547
- options = clientId;
3549
+ options = { clientId };
3548
3550
  }
3549
3551
  const target = targets[targetId];
3550
3552
  if (!target) {
3551
- return false;
3553
+ return [false];
3552
3554
  }
3553
3555
  const { convert } = target.clientsById[clientId || target.info.default];
3554
3556
  const results = this.requests.map((request) => convert(request, options));
3555
3557
  return results;
3556
3558
  }
3559
+ installation(targetId, clientId, options) {
3560
+ if (!this.initCalled) {
3561
+ this.init();
3562
+ }
3563
+ if (!options && clientId) {
3564
+ options = { clientId };
3565
+ }
3566
+ const target = targets[targetId];
3567
+ if (!target) {
3568
+ return [false];
3569
+ }
3570
+ const { info } = target.clientsById[clientId || target.info.default];
3571
+ const results = this.requests.map((request) => info?.installation ? info.installation(request, options) : false);
3572
+ return results;
3573
+ }
3557
3574
  };
3558
3575
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
3559
3576