@readme/httpsnippet 5.1.0 → 6.0.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.
Files changed (180) hide show
  1. package/dist/helpers/code-builder.js +1 -1
  2. package/dist/helpers/form-data.js +2 -2
  3. package/dist/helpers/headers.js +1 -1
  4. package/dist/helpers/reducer.js +1 -1
  5. package/dist/helpers/shell.js +1 -1
  6. package/dist/helpers/utils.js +1 -1
  7. package/dist/index.js +14 -25
  8. package/dist/targets/c/libcurl/client.js +3 -3
  9. package/dist/targets/c/target.js +4 -4
  10. package/dist/targets/clojure/clj_http/client.js +10 -7
  11. package/dist/targets/clojure/target.js +4 -4
  12. package/dist/targets/csharp/httpclient/client.js +4 -4
  13. package/dist/targets/csharp/restsharp/client.js +3 -3
  14. package/dist/targets/csharp/target.js +4 -4
  15. package/dist/targets/go/native/client.js +3 -3
  16. package/dist/targets/go/target.js +4 -4
  17. package/dist/targets/http/http1.1/client.js +3 -3
  18. package/dist/targets/http/target.js +4 -4
  19. package/dist/targets/java/asynchttp/client.js +3 -3
  20. package/dist/targets/java/nethttp/client.js +3 -3
  21. package/dist/targets/java/okhttp/client.js +3 -3
  22. package/dist/targets/java/target.js +4 -4
  23. package/dist/targets/java/unirest/client.js +3 -3
  24. package/dist/targets/javascript/axios/client.js +6 -6
  25. package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +5 -4
  26. package/dist/targets/javascript/axios/fixtures/application-json.js +4 -3
  27. package/dist/targets/javascript/axios/fixtures/cookies.js +4 -3
  28. package/dist/targets/javascript/axios/fixtures/custom-method.js +4 -3
  29. package/dist/targets/javascript/axios/fixtures/full.js +5 -4
  30. package/dist/targets/javascript/axios/fixtures/headers.js +4 -3
  31. package/dist/targets/javascript/axios/fixtures/http-insecure.js +4 -3
  32. package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +4 -3
  33. package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +4 -3
  34. package/dist/targets/javascript/axios/fixtures/multipart-data.js +4 -3
  35. package/dist/targets/javascript/axios/fixtures/multipart-file.js +4 -3
  36. package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +4 -3
  37. package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +4 -3
  38. package/dist/targets/javascript/axios/fixtures/nested.js +4 -3
  39. package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +4 -3
  40. package/dist/targets/javascript/axios/fixtures/query-encoded.js +4 -3
  41. package/dist/targets/javascript/axios/fixtures/query.js +4 -3
  42. package/dist/targets/javascript/axios/fixtures/short.js +4 -3
  43. package/dist/targets/javascript/axios/fixtures/text-plain.js +4 -3
  44. package/dist/targets/javascript/fetch/client.js +6 -6
  45. package/dist/targets/javascript/fetch/fixtures/application-form-encoded.d.ts +3 -3
  46. package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +2 -1
  47. package/dist/targets/javascript/fetch/fixtures/application-json.d.ts +3 -3
  48. package/dist/targets/javascript/fetch/fixtures/application-json.js +2 -1
  49. package/dist/targets/javascript/fetch/fixtures/cookies.d.ts +2 -2
  50. package/dist/targets/javascript/fetch/fixtures/cookies.js +2 -1
  51. package/dist/targets/javascript/fetch/fixtures/custom-method.d.ts +1 -1
  52. package/dist/targets/javascript/fetch/fixtures/custom-method.js +2 -1
  53. package/dist/targets/javascript/fetch/fixtures/full.d.ts +3 -3
  54. package/dist/targets/javascript/fetch/fixtures/full.js +2 -1
  55. package/dist/targets/javascript/fetch/fixtures/headers.d.ts +2 -2
  56. package/dist/targets/javascript/fetch/fixtures/headers.js +2 -1
  57. package/dist/targets/javascript/fetch/fixtures/http-insecure.d.ts +1 -1
  58. package/dist/targets/javascript/fetch/fixtures/http-insecure.js +2 -1
  59. package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.d.ts +3 -3
  60. package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +2 -1
  61. package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.d.ts +3 -3
  62. package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +2 -1
  63. package/dist/targets/javascript/fetch/fixtures/multipart-data.js +2 -1
  64. package/dist/targets/javascript/fetch/fixtures/multipart-file.d.ts +1 -1
  65. package/dist/targets/javascript/fetch/fixtures/multipart-file.js +2 -1
  66. package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.d.ts +2 -2
  67. package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +2 -1
  68. package/dist/targets/javascript/fetch/fixtures/multipart-form-data.d.ts +1 -1
  69. package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +2 -1
  70. package/dist/targets/javascript/fetch/fixtures/nested.d.ts +1 -1
  71. package/dist/targets/javascript/fetch/fixtures/nested.js +2 -1
  72. package/dist/targets/javascript/fetch/fixtures/postdata-malformed.d.ts +2 -2
  73. package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +2 -1
  74. package/dist/targets/javascript/fetch/fixtures/query-encoded.d.ts +1 -1
  75. package/dist/targets/javascript/fetch/fixtures/query-encoded.js +2 -1
  76. package/dist/targets/javascript/fetch/fixtures/query.d.ts +1 -1
  77. package/dist/targets/javascript/fetch/fixtures/query.js +2 -1
  78. package/dist/targets/javascript/fetch/fixtures/short.d.ts +1 -1
  79. package/dist/targets/javascript/fetch/fixtures/short.js +2 -1
  80. package/dist/targets/javascript/fetch/fixtures/text-plain.d.ts +3 -3
  81. package/dist/targets/javascript/fetch/fixtures/text-plain.js +2 -1
  82. package/dist/targets/javascript/jquery/client.js +5 -5
  83. package/dist/targets/javascript/jquery/fixtures/application-form-encoded.d.ts +7 -7
  84. package/dist/targets/javascript/jquery/fixtures/application-json.d.ts +7 -7
  85. package/dist/targets/javascript/jquery/fixtures/cookies.d.ts +5 -5
  86. package/dist/targets/javascript/jquery/fixtures/custom-method.d.ts +5 -5
  87. package/dist/targets/javascript/jquery/fixtures/full.d.ts +6 -6
  88. package/dist/targets/javascript/jquery/fixtures/headers.d.ts +5 -5
  89. package/dist/targets/javascript/jquery/fixtures/http-insecure.d.ts +5 -5
  90. package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.d.ts +7 -7
  91. package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.d.ts +7 -7
  92. package/dist/targets/javascript/jquery/fixtures/multipart-data.d.ts +9 -9
  93. package/dist/targets/javascript/jquery/fixtures/multipart-file.d.ts +9 -9
  94. package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.d.ts +5 -5
  95. package/dist/targets/javascript/jquery/fixtures/multipart-form-data.d.ts +9 -9
  96. package/dist/targets/javascript/jquery/fixtures/nested.d.ts +5 -5
  97. package/dist/targets/javascript/jquery/fixtures/postdata-malformed.d.ts +5 -5
  98. package/dist/targets/javascript/jquery/fixtures/query-encoded.d.ts +5 -5
  99. package/dist/targets/javascript/jquery/fixtures/query.d.ts +5 -5
  100. package/dist/targets/javascript/jquery/fixtures/short.d.ts +5 -5
  101. package/dist/targets/javascript/jquery/fixtures/text-plain.d.ts +6 -6
  102. package/dist/targets/javascript/target.js +4 -4
  103. package/dist/targets/javascript/xhr/client.js +5 -5
  104. package/dist/targets/kotlin/okhttp/client.js +3 -3
  105. package/dist/targets/kotlin/target.js +4 -4
  106. package/dist/targets/node/axios/client.js +5 -5
  107. package/dist/targets/node/axios/fixtures/application-form-encoded.js +3 -2
  108. package/dist/targets/node/axios/fixtures/application-json.js +2 -1
  109. package/dist/targets/node/axios/fixtures/cookies.js +2 -1
  110. package/dist/targets/node/axios/fixtures/custom-method.js +2 -1
  111. package/dist/targets/node/axios/fixtures/full.js +3 -2
  112. package/dist/targets/node/axios/fixtures/headers.js +2 -1
  113. package/dist/targets/node/axios/fixtures/http-insecure.js +2 -1
  114. package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +2 -1
  115. package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +2 -1
  116. package/dist/targets/node/axios/fixtures/multipart-data.js +2 -1
  117. package/dist/targets/node/axios/fixtures/multipart-file.js +2 -1
  118. package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +2 -1
  119. package/dist/targets/node/axios/fixtures/multipart-form-data.js +2 -1
  120. package/dist/targets/node/axios/fixtures/nested.js +2 -1
  121. package/dist/targets/node/axios/fixtures/postdata-malformed.js +2 -1
  122. package/dist/targets/node/axios/fixtures/query-encoded.js +2 -1
  123. package/dist/targets/node/axios/fixtures/query.js +2 -1
  124. package/dist/targets/node/axios/fixtures/short.js +2 -1
  125. package/dist/targets/node/axios/fixtures/text-plain.js +2 -1
  126. package/dist/targets/node/fetch/client.js +6 -6
  127. package/dist/targets/node/fetch/fixtures/application-form-encoded.js +2 -1
  128. package/dist/targets/node/fetch/fixtures/application-json.js +2 -1
  129. package/dist/targets/node/fetch/fixtures/cookies.js +2 -1
  130. package/dist/targets/node/fetch/fixtures/custom-method.js +2 -1
  131. package/dist/targets/node/fetch/fixtures/full.js +2 -1
  132. package/dist/targets/node/fetch/fixtures/headers.js +2 -1
  133. package/dist/targets/node/fetch/fixtures/http-insecure.js +2 -1
  134. package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +2 -1
  135. package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +2 -1
  136. package/dist/targets/node/fetch/fixtures/multipart-data.js +2 -1
  137. package/dist/targets/node/fetch/fixtures/multipart-file.js +2 -1
  138. package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +2 -1
  139. package/dist/targets/node/fetch/fixtures/multipart-form-data.js +2 -1
  140. package/dist/targets/node/fetch/fixtures/nested.js +2 -1
  141. package/dist/targets/node/fetch/fixtures/postdata-malformed.js +2 -1
  142. package/dist/targets/node/fetch/fixtures/query-encoded.js +2 -1
  143. package/dist/targets/node/fetch/fixtures/query.js +2 -1
  144. package/dist/targets/node/fetch/fixtures/short.js +2 -1
  145. package/dist/targets/node/fetch/fixtures/text-plain.js +2 -1
  146. package/dist/targets/node/native/client.js +10 -10
  147. package/dist/targets/node/request/client.js +7 -7
  148. package/dist/targets/node/target.js +5 -5
  149. package/dist/targets/node/unirest/client.js +10 -10
  150. package/dist/targets/objc/helpers.js +1 -1
  151. package/dist/targets/objc/nsurlsession/client.js +4 -4
  152. package/dist/targets/objc/target.js +4 -4
  153. package/dist/targets/ocaml/cohttp/client.js +3 -3
  154. package/dist/targets/ocaml/target.js +4 -4
  155. package/dist/targets/php/curl/client.js +12 -12
  156. package/dist/targets/php/guzzle/client.js +5 -5
  157. package/dist/targets/php/helpers.js +1 -1
  158. package/dist/targets/php/http1/client.js +3 -3
  159. package/dist/targets/php/http2/client.js +4 -4
  160. package/dist/targets/php/target.js +5 -5
  161. package/dist/targets/powershell/common.js +1 -1
  162. package/dist/targets/powershell/restmethod/client.js +3 -3
  163. package/dist/targets/powershell/target.js +4 -4
  164. package/dist/targets/powershell/webrequest/client.js +3 -3
  165. package/dist/targets/python/helpers.js +1 -1
  166. package/dist/targets/python/requests/client.js +3 -3
  167. package/dist/targets/python/target.js +5 -5
  168. package/dist/targets/r/httr/client.js +3 -3
  169. package/dist/targets/r/target.js +4 -4
  170. package/dist/targets/ruby/native/client.js +3 -3
  171. package/dist/targets/ruby/target.js +4 -4
  172. package/dist/targets/shell/curl/client.js +4 -4
  173. package/dist/targets/shell/httpie/client.js +4 -4
  174. package/dist/targets/shell/target.js +5 -5
  175. package/dist/targets/shell/wget/client.js +3 -3
  176. package/dist/targets/swift/helpers.js +1 -1
  177. package/dist/targets/swift/nsurlsession/client.js +4 -4
  178. package/dist/targets/swift/target.js +4 -4
  179. package/dist/targets/targets.js +4 -4
  180. package/package.json +14 -14
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.kotlin = void 0;
4
4
  var client_1 = require("./okhttp/client");
5
5
  exports.kotlin = {
@@ -7,9 +7,9 @@ exports.kotlin = {
7
7
  key: 'kotlin',
8
8
  title: 'Kotlin',
9
9
  extname: '.kt',
10
- "default": 'okhttp'
10
+ default: 'okhttp',
11
11
  },
12
12
  clientsById: {
13
- okhttp: client_1.okhttp
14
- }
13
+ okhttp: client_1.okhttp,
14
+ },
15
15
  };
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.axios = void 0;
18
18
  var stringify_object_1 = __importDefault(require("stringify-object"));
19
19
  var code_builder_1 = require("../../../helpers/code-builder");
@@ -22,7 +22,7 @@ exports.axios = {
22
22
  key: 'axios',
23
23
  title: 'Axios',
24
24
  link: 'https://github.com/axios/axios',
25
- description: 'Promise based HTTP client for the browser and node.js'
25
+ description: 'Promise based HTTP client for the browser and node.js',
26
26
  },
27
27
  convert: function (_a, options) {
28
28
  var method = _a.method, fullUrl = _a.fullUrl, allHeaders = _a.allHeaders, postData = _a.postData;
@@ -31,7 +31,7 @@ exports.axios = {
31
31
  push("const axios = require('axios');");
32
32
  var reqOpts = {
33
33
  method: method,
34
- url: fullUrl
34
+ url: fullUrl,
35
35
  };
36
36
  if (Object.keys(allHeaders).length) {
37
37
  reqOpts.headers = allHeaders;
@@ -62,7 +62,7 @@ exports.axios = {
62
62
  reqOpts.data = postData.text;
63
63
  }
64
64
  }
65
- var stringifiedOptions = (0, stringify_object_1["default"])(reqOpts, { indent: ' ', inlineCharacterLimit: 80 });
65
+ var stringifiedOptions = (0, stringify_object_1.default)(reqOpts, { indent: ' ', inlineCharacterLimit: 80 });
66
66
  push("const options = ".concat(stringifiedOptions, ";"));
67
67
  blank();
68
68
  push('axios');
@@ -74,5 +74,5 @@ exports.axios = {
74
74
  push('console.error(error);', 2);
75
75
  push('});', 1);
76
76
  return join();
77
- }
77
+ },
78
78
  };
@@ -8,12 +8,13 @@ var options = {
8
8
  method: 'POST',
9
9
  url: 'https://httpbin.org/anything',
10
10
  headers: { 'content-type': 'application/x-www-form-urlencoded' },
11
- data: encodedParams
11
+ data: encodedParams,
12
12
  };
13
13
  axios
14
14
  .request(options)
15
15
  .then(function (response) {
16
16
  console.log(response.data);
17
- })["catch"](function (error) {
17
+ })
18
+ .catch(function (error) {
18
19
  console.error(error);
19
20
  });
@@ -17,6 +17,7 @@ axios
17
17
  .request(options)
18
18
  .then(function (response) {
19
19
  console.log(response.data);
20
- })["catch"](function (error) {
20
+ })
21
+ .catch(function (error) {
21
22
  console.error(error);
22
23
  });
@@ -9,6 +9,7 @@ axios
9
9
  .request(options)
10
10
  .then(function (response) {
11
11
  console.log(response.data);
12
- })["catch"](function (error) {
12
+ })
13
+ .catch(function (error) {
13
14
  console.error(error);
14
15
  });
@@ -5,6 +5,7 @@ axios
5
5
  .request(options)
6
6
  .then(function (response) {
7
7
  console.log(response.data);
8
- })["catch"](function (error) {
8
+ })
9
+ .catch(function (error) {
9
10
  console.error(error);
10
11
  });
@@ -11,12 +11,13 @@ var options = {
11
11
  accept: 'application/json',
12
12
  'content-type': 'application/x-www-form-urlencoded'
13
13
  },
14
- data: encodedParams
14
+ data: encodedParams,
15
15
  };
16
16
  axios
17
17
  .request(options)
18
18
  .then(function (response) {
19
19
  console.log(response.data);
20
- })["catch"](function (error) {
20
+ })
21
+ .catch(function (error) {
21
22
  console.error(error);
22
23
  });
@@ -9,6 +9,7 @@ axios
9
9
  .request(options)
10
10
  .then(function (response) {
11
11
  console.log(response.data);
12
- })["catch"](function (error) {
12
+ })
13
+ .catch(function (error) {
13
14
  console.error(error);
14
15
  });
@@ -5,6 +5,7 @@ axios
5
5
  .request(options)
6
6
  .then(function (response) {
7
7
  console.log(response.data);
8
- })["catch"](function (error) {
8
+ })
9
+ .catch(function (error) {
9
10
  console.error(error);
10
11
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -9,6 +9,7 @@ axios
9
9
  .request(options)
10
10
  .then(function (response) {
11
11
  console.log(response.data);
12
- })["catch"](function (error) {
12
+ })
13
+ .catch(function (error) {
13
14
  console.error(error);
14
15
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -8,6 +8,7 @@ axios
8
8
  .request(options)
9
9
  .then(function (response) {
10
10
  console.log(response.data);
11
- })["catch"](function (error) {
11
+ })
12
+ .catch(function (error) {
12
13
  console.error(error);
13
14
  });
@@ -9,6 +9,7 @@ axios
9
9
  .request(options)
10
10
  .then(function (response) {
11
11
  console.log(response.data);
12
- })["catch"](function (error) {
12
+ })
13
+ .catch(function (error) {
13
14
  console.error(error);
14
15
  });
@@ -8,6 +8,7 @@ axios
8
8
  .request(options)
9
9
  .then(function (response) {
10
10
  console.log(response.data);
11
- })["catch"](function (error) {
11
+ })
12
+ .catch(function (error) {
12
13
  console.error(error);
13
14
  });
@@ -8,6 +8,7 @@ axios
8
8
  .request(options)
9
9
  .then(function (response) {
10
10
  console.log(response.data);
11
- })["catch"](function (error) {
11
+ })
12
+ .catch(function (error) {
12
13
  console.error(error);
13
14
  });
@@ -5,6 +5,7 @@ axios
5
5
  .request(options)
6
6
  .then(function (response) {
7
7
  console.log(response.data);
8
- })["catch"](function (error) {
8
+ })
9
+ .catch(function (error) {
9
10
  console.error(error);
10
11
  });
@@ -10,6 +10,7 @@ axios
10
10
  .request(options)
11
11
  .then(function (response) {
12
12
  console.log(response.data);
13
- })["catch"](function (error) {
13
+ })
14
+ .catch(function (error) {
14
15
  console.error(error);
15
16
  });
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.fetch = void 0;
18
18
  var stringify_object_1 = __importDefault(require("stringify-object"));
19
19
  var code_builder_1 = require("../../../helpers/code-builder");
@@ -23,7 +23,7 @@ exports.fetch = {
23
23
  key: 'fetch',
24
24
  title: 'Fetch',
25
25
  link: 'https://github.com/bitinn/node-fetch',
26
- description: 'Simplified HTTP node-fetch client'
26
+ description: 'Simplified HTTP node-fetch client',
27
27
  },
28
28
  convert: function (_a, options) {
29
29
  var _b;
@@ -34,7 +34,7 @@ exports.fetch = {
34
34
  push("const fetch = require('node-fetch');");
35
35
  var url = fullUrl;
36
36
  var reqOpts = {
37
- method: method
37
+ method: method,
38
38
  };
39
39
  if (Object.keys(headersObj).length) {
40
40
  reqOpts.headers = headersObj;
@@ -107,7 +107,7 @@ exports.fetch = {
107
107
  if (reqOpts.headers && !Object.keys(reqOpts.headers).length) {
108
108
  delete reqOpts.headers;
109
109
  }
110
- var stringifiedOptions = (0, stringify_object_1["default"])(reqOpts, {
110
+ var stringifiedOptions = (0, stringify_object_1.default)(reqOpts, {
111
111
  indent: ' ',
112
112
  inlineCharacterLimit: 80,
113
113
  // The Fetch API body only accepts string parameters, but stringified JSON can be difficult to
@@ -118,7 +118,7 @@ exports.fetch = {
118
118
  return "JSON.stringify(".concat(originalResult, ")");
119
119
  }
120
120
  return originalResult;
121
- }
121
+ },
122
122
  });
123
123
  push("const options = ".concat(stringifiedOptions, ";"));
124
124
  blank();
@@ -136,5 +136,5 @@ exports.fetch = {
136
136
  return join()
137
137
  .replace(/'encodedParams'/, 'encodedParams')
138
138
  .replace(/"fs\.createReadStream\(\\"(.+)\\"\)"/, 'fs.createReadStream("$1")');
139
- }
139
+ },
140
140
  };
@@ -12,4 +12,5 @@ var options = {
12
12
  };
13
13
  fetch(url, options)
14
14
  .then(function (res) { return res.json(); })
15
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
15
+ .then(function (json) { return console.log(json); })
16
+ .catch(function (err) { return console.error('error:' + err); });
@@ -15,4 +15,5 @@ var options = {
15
15
  };
16
16
  fetch(url, options)
17
17
  .then(function (res) { return res.json(); })
18
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
18
+ .then(function (json) { return console.log(json); })
19
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/cookies';
4
4
  var options = { method: 'GET', headers: { cookie: 'foo=bar; bar=baz' } };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything';
4
4
  var options = { method: 'PROPFIND' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -15,4 +15,5 @@ var options = {
15
15
  };
16
16
  fetch(url, options)
17
17
  .then(function (res) { return res.json(); })
18
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
18
+ .then(function (json) { return console.log(json); })
19
+ .catch(function (err) { return console.error('error:' + err); });
@@ -7,4 +7,5 @@ var options = {
7
7
  };
8
8
  fetch(url, options)
9
9
  .then(function (res) { return res.json(); })
10
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
10
+ .then(function (json) { return console.log(json); })
11
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'http://httpbin.org/anything';
4
4
  var options = { method: 'GET' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -8,4 +8,5 @@ var options = {
8
8
  };
9
9
  fetch(url, options)
10
10
  .then(function (res) { return res.json(); })
11
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
11
+ .then(function (json) { return console.log(json); })
12
+ .catch(function (err) { return console.error('error:' + err); });
@@ -8,4 +8,5 @@ var options = {
8
8
  };
9
9
  fetch(url, options)
10
10
  .then(function (res) { return res.json(); })
11
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
11
+ .then(function (json) { return console.log(json); })
12
+ .catch(function (err) { return console.error('error:' + err); });
@@ -10,4 +10,5 @@ var options = { method: 'POST' };
10
10
  options.body = formData;
11
11
  fetch(url, options)
12
12
  .then(function (res) { return res.json(); })
13
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
13
+ .then(function (json) { return console.log(json); })
14
+ .catch(function (err) { return console.error('error:' + err); });
@@ -9,4 +9,5 @@ var options = { method: 'POST' };
9
9
  options.body = formData;
10
10
  fetch(url, options)
11
11
  .then(function (res) { return res.json(); })
12
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
12
+ .then(function (json) { return console.log(json); })
13
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything';
4
4
  var options = { method: 'POST', headers: { 'Content-Type': 'multipart/form-data' } };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -8,4 +8,5 @@ var options = { method: 'POST' };
8
8
  options.body = formData;
9
9
  fetch(url, options)
10
10
  .then(function (res) { return res.json(); })
11
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
11
+ .then(function (json) { return console.log(json); })
12
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value
4
4
  var options = { method: 'GET' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything';
4
4
  var options = { method: 'POST', headers: { 'content-type': 'application/json' } };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything?startTime=2019-06-13T19%3A08%3A25.455Z&e
4
4
  var options = { method: 'GET' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything?foo=bar&foo=baz&baz=abc&key=value';
4
4
  var options = { method: 'GET' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything';
4
4
  var options = { method: 'GET' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -4,4 +4,5 @@ var url = 'https://httpbin.org/anything';
4
4
  var options = { method: 'POST', headers: { 'content-type': 'text/plain' }, body: 'Hello World' };
5
5
  fetch(url, options)
6
6
  .then(function (res) { return res.json(); })
7
- .then(function (json) { return console.log(json); })["catch"](function (err) { return console.error('error:' + err); });
7
+ .then(function (json) { return console.log(json); })
8
+ .catch(function (err) { return console.error('error:' + err); });
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.native = void 0;
18
18
  var stringify_object_1 = __importDefault(require("stringify-object"));
19
19
  var code_builder_1 = require("../../../helpers/code-builder");
@@ -22,7 +22,7 @@ exports.native = {
22
22
  key: 'native',
23
23
  title: 'HTTP',
24
24
  link: 'http://nodejs.org/api/http.html#http_http_request_options_callback',
25
- description: 'Node.js native HTTP interface'
25
+ description: 'Node.js native HTTP interface',
26
26
  },
27
27
  convert: function (_a, options) {
28
28
  var _b;
@@ -34,11 +34,11 @@ exports.native = {
34
34
  hostname: uriObj.hostname,
35
35
  port: uriObj.port,
36
36
  path: uriObj.path,
37
- headers: allHeaders
37
+ headers: allHeaders,
38
38
  };
39
39
  push("const http = require('".concat((_b = uriObj.protocol) === null || _b === void 0 ? void 0 : _b.replace(':', ''), "');"));
40
40
  blank();
41
- push("const options = ".concat((0, stringify_object_1["default"])(reqOpts, { indent: opts.indent }), ";"));
41
+ push("const options = ".concat((0, stringify_object_1.default)(reqOpts, { indent: opts.indent }), ";"));
42
42
  blank();
43
43
  push('const req = http.request(options, function (res) {');
44
44
  push('const chunks = [];', 1);
@@ -57,26 +57,26 @@ exports.native = {
57
57
  case 'application/x-www-form-urlencoded':
58
58
  if (postData.paramsObj) {
59
59
  unshift("const qs = require('querystring');");
60
- push("req.write(qs.stringify(".concat((0, stringify_object_1["default"])(postData.paramsObj, {
60
+ push("req.write(qs.stringify(".concat((0, stringify_object_1.default)(postData.paramsObj, {
61
61
  indent: ' ',
62
- inlineCharacterLimit: 80
62
+ inlineCharacterLimit: 80,
63
63
  }), "));"));
64
64
  }
65
65
  break;
66
66
  case 'application/json':
67
67
  if (postData.jsonObj) {
68
- push("req.write(JSON.stringify(".concat((0, stringify_object_1["default"])(postData.jsonObj, {
68
+ push("req.write(JSON.stringify(".concat((0, stringify_object_1.default)(postData.jsonObj, {
69
69
  indent: ' ',
70
- inlineCharacterLimit: 80
70
+ inlineCharacterLimit: 80,
71
71
  }), "));"));
72
72
  }
73
73
  break;
74
74
  default:
75
75
  if (postData.text) {
76
- push("req.write(".concat((0, stringify_object_1["default"])(postData.text, { indent: opts.indent }), ");"));
76
+ push("req.write(".concat((0, stringify_object_1.default)(postData.text, { indent: opts.indent }), ");"));
77
77
  }
78
78
  }
79
79
  push('req.end();');
80
80
  return join();
81
- }
81
+ },
82
82
  };
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.request = void 0;
18
18
  var stringify_object_1 = __importDefault(require("stringify-object"));
19
19
  var code_builder_1 = require("../../../helpers/code-builder");
@@ -22,7 +22,7 @@ exports.request = {
22
22
  key: 'request',
23
23
  title: 'Request',
24
24
  link: 'https://github.com/request/request',
25
- description: 'Simplified HTTP request client'
25
+ description: 'Simplified HTTP request client',
26
26
  },
27
27
  convert: function (_a, options) {
28
28
  var method = _a.method, url = _a.url, fullUrl = _a.fullUrl, postData = _a.postData, headersObj = _a.headersObj, cookies = _a.cookies;
@@ -33,7 +33,7 @@ exports.request = {
33
33
  blank();
34
34
  var reqOpts = {
35
35
  method: method,
36
- url: fullUrl
36
+ url: fullUrl,
37
37
  };
38
38
  if (Object.keys(headersObj).length) {
39
39
  reqOpts.headers = headersObj;
@@ -65,8 +65,8 @@ exports.request = {
65
65
  value: "fs.createReadStream(".concat(param.fileName, ")"),
66
66
  options: {
67
67
  filename: param.fileName,
68
- contentType: param.contentType ? param.contentType : null
69
- }
68
+ contentType: param.contentType ? param.contentType : null,
69
+ },
70
70
  };
71
71
  }
72
72
  else if (param.value) {
@@ -95,7 +95,7 @@ exports.request = {
95
95
  if (includeFS) {
96
96
  unshift("const fs = require('fs');");
97
97
  }
98
- push("const options = ".concat((0, stringify_object_1["default"])(reqOpts, { indent: ' ', inlineCharacterLimit: 80 }), ";"));
98
+ push("const options = ".concat((0, stringify_object_1.default)(reqOpts, { indent: ' ', inlineCharacterLimit: 80 }), ";"));
99
99
  blank();
100
100
  push('request(options, function (error, response, body) {');
101
101
  push('if (error) throw new Error(error);', 1);
@@ -103,5 +103,5 @@ exports.request = {
103
103
  push('console.log(body);', 1);
104
104
  push('});');
105
105
  return join();
106
- }
106
+ },
107
107
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.node = void 0;
4
4
  var client_1 = require("./axios/client");
5
5
  var client_2 = require("./fetch/client");
@@ -11,14 +11,14 @@ exports.node = {
11
11
  key: 'node',
12
12
  title: 'Node.js',
13
13
  extname: '.js',
14
- "default": 'native',
15
- cli: 'node %s'
14
+ default: 'native',
15
+ cli: 'node %s',
16
16
  },
17
17
  clientsById: {
18
18
  native: client_3.native,
19
19
  request: client_4.request,
20
20
  unirest: client_5.unirest,
21
21
  axios: client_1.axios,
22
- fetch: client_2.fetch
23
- }
22
+ fetch: client_2.fetch,
23
+ },
24
24
  };