@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
@@ -24,7 +24,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
24
  }
25
25
  return to.concat(ar || Array.prototype.slice.call(from));
26
26
  };
27
- exports.__esModule = true;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.CodeBuilder = void 0;
29
29
  var DEFAULT_INDENTATION_CHARACTER = '';
30
30
  var DEFAULT_LINE_JOIN = '\n';
@@ -80,7 +80,7 @@ var __read = (this && this.__read) || function (o, n) {
80
80
  }
81
81
  return ar;
82
82
  };
83
- exports.__esModule = true;
83
+ Object.defineProperty(exports, "__esModule", { value: true });
84
84
  exports.formDataIterator = exports.isBlob = void 0;
85
85
  var carriage = '\r\n';
86
86
  var dashes = '-'.repeat(2);
@@ -143,7 +143,7 @@ var formDataIterator = function (form, boundary) {
143
143
  return [3 /*break*/, 12];
144
144
  case 11:
145
145
  try {
146
- if (form_1_1 && !form_1_1.done && (_b = form_1["return"])) _b.call(form_1);
146
+ if (form_1_1 && !form_1_1.done && (_b = form_1.return)) _b.call(form_1);
147
147
  }
148
148
  finally { if (e_1) throw e_1.error; }
149
149
  return [7 /*endfinally*/];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isMimeTypeJSON = exports.hasHeader = exports.getHeader = exports.getHeaderName = void 0;
4
4
  /**
5
5
  * Given a headers object retrieve a specific header out of it via a case-insensitive key.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reducer = void 0;
4
4
  var reducer = function (accumulator, pair) {
5
5
  var currentValue = accumulator[pair.name];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.escape = exports.quote = void 0;
4
4
  /**
5
5
  * Use 'strong quoting' using single quotes so that we only need to deal with nested single quote characters.
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.extname = exports.availableTargets = void 0;
15
15
  var targets_1 = require("../targets/targets");
16
16
  var availableTargets = function () {
package/dist/index.js CHANGED
@@ -10,17 +10,6 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
13
  var __values = (this && this.__values) || function(o) {
25
14
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
26
15
  if (m) return m.call(o);
@@ -35,7 +24,7 @@ var __values = (this && this.__values) || function(o) {
35
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
26
  };
38
- exports.__esModule = true;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
39
28
  exports.HTTPSnippet = exports.addTargetClient = exports.addTarget = exports.extname = exports.availableTargets = void 0;
40
29
  // eslint-disable-next-line node/no-deprecated-api
41
30
  var url_1 = require("url");
@@ -47,15 +36,15 @@ var headers_1 = require("./helpers/headers");
47
36
  var reducer_1 = require("./helpers/reducer");
48
37
  var targets_1 = require("./targets/targets");
49
38
  var utils_1 = require("./helpers/utils");
50
- __createBinding(exports, utils_1, "availableTargets");
51
- __createBinding(exports, utils_1, "extname");
39
+ Object.defineProperty(exports, "availableTargets", { enumerable: true, get: function () { return utils_1.availableTargets; } });
40
+ Object.defineProperty(exports, "extname", { enumerable: true, get: function () { return utils_1.extname; } });
52
41
  var targets_2 = require("./targets/targets");
53
- __createBinding(exports, targets_2, "addTarget");
54
- __createBinding(exports, targets_2, "addTargetClient");
42
+ Object.defineProperty(exports, "addTarget", { enumerable: true, get: function () { return targets_2.addTarget; } });
43
+ Object.defineProperty(exports, "addTargetClient", { enumerable: true, get: function () { return targets_2.addTargetClient; } });
55
44
  var DEBUG_MODE = false;
56
45
  var debug = {
57
46
  // eslint-disable-next-line @typescript-eslint/no-empty-function, no-console
58
- info: DEBUG_MODE ? console.info : function () { }
47
+ info: DEBUG_MODE ? console.info : function () { },
59
48
  };
60
49
  var isHarEntry = function (value) {
61
50
  return typeof value === 'object' &&
@@ -116,7 +105,7 @@ var HTTPSnippet = /** @class */ (function () {
116
105
  request.postData.text = '';
117
106
  request.postData.mimeType = 'multipart/form-data';
118
107
  if ((_c = request.postData) === null || _c === void 0 ? void 0 : _c.params) {
119
- var form_1 = new form_data_1["default"]();
108
+ var form_1 = new form_data_1.default();
120
109
  // The `form-data` module returns one of two things: a native FormData object, or its own polyfill
121
110
  // Since the polyfill does not support the full API of the native FormData object, when this library is running in a browser environment it'll fail on two things:
122
111
  //
@@ -155,7 +144,7 @@ var HTTPSnippet = /** @class */ (function () {
155
144
  // @ts-expect-error TODO
156
145
  filename: filename,
157
146
  // @ts-expect-error TODO
158
- contentType: param.contentType || null
147
+ contentType: param.contentType || null,
159
148
  });
160
149
  }
161
150
  });
@@ -170,7 +159,7 @@ var HTTPSnippet = /** @class */ (function () {
170
159
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
171
160
  finally {
172
161
  try {
173
- if (_f && !_f.done && (_a = _e["return"])) _a.call(_e);
162
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
174
163
  }
175
164
  finally { if (e_1) throw e_1.error; }
176
165
  }
@@ -226,12 +215,12 @@ var HTTPSnippet = /** @class */ (function () {
226
215
  if (options.harIsAlreadyEncoded) {
227
216
  search = (0, qs_1.stringify)(request.queryObj, {
228
217
  encode: false,
229
- indices: false
218
+ indices: false,
230
219
  });
231
220
  }
232
221
  else {
233
222
  search = (0, qs_1.stringify)(request.queryObj, {
234
- indices: false
223
+ indices: false,
235
224
  });
236
225
  }
237
226
  var uriObj = __assign(__assign({}, urlWithParsedQuery), { query: request.queryObj, search: search, path: search ? "".concat(urlWithParsedQuery.pathname, "?").concat(search) : urlWithParsedQuery.pathname });
@@ -248,7 +237,7 @@ var HTTPSnippet = /** @class */ (function () {
248
237
  if (!target) {
249
238
  return false;
250
239
  }
251
- var convert = target.clientsById[clientId || target.info["default"]].convert;
240
+ var convert = target.clientsById[clientId || target.info.default].convert;
252
241
  var results = _this.requests.map(function (request) { return convert(request, options); });
253
242
  return results.length === 1 ? results[0] : results;
254
243
  };
@@ -263,7 +252,7 @@ var HTTPSnippet = /** @class */ (function () {
263
252
  else {
264
253
  entries = [
265
254
  {
266
- request: input
255
+ request: input,
267
256
  },
268
257
  ];
269
258
  }
@@ -272,7 +261,7 @@ var HTTPSnippet = /** @class */ (function () {
272
261
  var request = _a.request;
273
262
  // add optional properties to make validation successful
274
263
  var req = __assign({ bodySize: 0, headersSize: 0, headers: [], cookies: [], httpVersion: 'HTTP/1.1', queryString: [], postData: {
275
- mimeType: ((_b = request.postData) === null || _b === void 0 ? void 0 : _b.mimeType) || 'application/octet-stream'
264
+ mimeType: ((_b = request.postData) === null || _b === void 0 ? void 0 : _b.mimeType) || 'application/octet-stream',
276
265
  } }, request);
277
266
  // Per the HAR spec `mimeType` needs to always be present if we have a `postData` object.
278
267
  if (req.postData && !req.postData.mimeType) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.libcurl = void 0;
4
4
  var code_builder_1 = require("../../../helpers/code-builder");
5
5
  exports.libcurl = {
@@ -7,7 +7,7 @@ exports.libcurl = {
7
7
  key: 'libcurl',
8
8
  title: 'Libcurl',
9
9
  link: 'http://curl.haxx.se/libcurl',
10
- description: 'Simple REST and HTTP API Client for C'
10
+ description: 'Simple REST and HTTP API Client for C',
11
11
  },
12
12
  convert: function (_a) {
13
13
  var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
@@ -39,5 +39,5 @@ exports.libcurl = {
39
39
  blank();
40
40
  push('CURLcode ret = curl_easy_perform(hnd);');
41
41
  return join();
42
- }
42
+ },
43
43
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.c = void 0;
4
4
  var client_1 = require("./libcurl/client");
5
5
  exports.c = {
@@ -7,9 +7,9 @@ exports.c = {
7
7
  key: 'c',
8
8
  title: 'C',
9
9
  extname: '.c',
10
- "default": 'libcurl'
10
+ default: 'libcurl',
11
11
  },
12
12
  clientsById: {
13
- libcurl: client_1.libcurl
14
- }
13
+ libcurl: client_1.libcurl,
14
+ },
15
15
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clj_http = void 0;
4
4
  var code_builder_1 = require("../../../helpers/code-builder");
5
5
  var headers_1 = require("../../../helpers/headers");
@@ -31,7 +31,10 @@ var jsType = function (input) {
31
31
  return input.constructor.name.toLowerCase();
32
32
  };
33
33
  var objEmpty = function (input) {
34
- if (jsType(input) === 'object') {
34
+ if (input === undefined) {
35
+ return true;
36
+ }
37
+ else if (jsType(input) === 'object') {
35
38
  return Object.keys(input).length === 0;
36
39
  }
37
40
  return false;
@@ -84,7 +87,7 @@ exports.clj_http = {
84
87
  key: 'clj_http',
85
88
  title: 'clj-http',
86
89
  link: 'https://github.com/dakrone/clj-http',
87
- description: 'An idiomatic clojure http client wrapping the apache client.'
90
+ description: 'An idiomatic clojure http client wrapping the apache client.',
88
91
  },
89
92
  convert: function (_a, options) {
90
93
  var queryObj = _a.queryObj, method = _a.method, postData = _a.postData, url = _a.url, allHeaders = _a.allHeaders;
@@ -97,7 +100,7 @@ exports.clj_http = {
97
100
  }
98
101
  var params = {
99
102
  headers: allHeaders,
100
- 'query-params': queryObj
103
+ 'query-params': queryObj,
101
104
  };
102
105
  switch (postData.mimeType) {
103
106
  case 'application/json':
@@ -134,12 +137,12 @@ exports.clj_http = {
134
137
  if (param.fileName && !param.value) {
135
138
  return {
136
139
  name: param.name,
137
- content: new File(param.fileName)
140
+ content: new File(param.fileName),
138
141
  };
139
142
  }
140
143
  return {
141
144
  name: param.name,
142
- content: param.value
145
+ content: param.value,
143
146
  };
144
147
  });
145
148
  var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
@@ -171,5 +174,5 @@ exports.clj_http = {
171
174
  push("(client/".concat(method, " \"").concat(url, "\" ").concat(formattedParams, ")"));
172
175
  }
173
176
  return join();
174
- }
177
+ },
175
178
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clojure = void 0;
4
4
  var client_1 = require("./clj_http/client");
5
5
  exports.clojure = {
@@ -7,9 +7,9 @@ exports.clojure = {
7
7
  key: 'clojure',
8
8
  title: 'Clojure',
9
9
  extname: '.clj',
10
- "default": 'clj_http'
10
+ default: 'clj_http',
11
11
  },
12
12
  clientsById: {
13
- clj_http: client_1.clj_http
14
- }
13
+ clj_http: client_1.clj_http,
14
+ },
15
15
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.httpclient = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  var headers_1 = require("../../../helpers/headers");
@@ -21,7 +21,7 @@ var getDecompressionMethods = function (allHeaders) {
21
21
  }
22
22
  var supportedMethods = {
23
23
  gzip: 'DecompressionMethods.GZip',
24
- deflate: 'DecompressionMethods.Deflate'
24
+ deflate: 'DecompressionMethods.Deflate',
25
25
  };
26
26
  var methods = [];
27
27
  if (typeof acceptEncodings === 'string') {
@@ -45,7 +45,7 @@ exports.httpclient = {
45
45
  key: 'httpclient',
46
46
  title: 'HttpClient',
47
47
  link: 'https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient',
48
- description: '.NET Standard HTTP Client'
48
+ description: '.NET Standard HTTP Client',
49
49
  },
50
50
  convert: function (_a, options) {
51
51
  var _b, _c;
@@ -158,5 +158,5 @@ exports.httpclient = {
158
158
  push('Console.WriteLine(body);', 1);
159
159
  push('}');
160
160
  return join();
161
- }
161
+ },
162
162
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.restsharp = void 0;
4
4
  var code_builder_1 = require("../../../helpers/code-builder");
5
5
  var headers_1 = require("../../../helpers/headers");
@@ -8,7 +8,7 @@ exports.restsharp = {
8
8
  key: 'restsharp',
9
9
  title: 'RestSharp',
10
10
  link: 'http://restsharp.org/',
11
- description: 'Simple REST and HTTP API Client for .NET'
11
+ description: 'Simple REST and HTTP API Client for .NET',
12
12
  },
13
13
  convert: function (_a) {
14
14
  var allHeaders = _a.allHeaders, method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, cookies = _a.cookies, postData = _a.postData;
@@ -34,5 +34,5 @@ exports.restsharp = {
34
34
  }
35
35
  push('IRestResponse response = client.Execute(request);');
36
36
  return join();
37
- }
37
+ },
38
38
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.csharp = void 0;
4
4
  var client_1 = require("./httpclient/client");
5
5
  var client_2 = require("./restsharp/client");
@@ -8,10 +8,10 @@ exports.csharp = {
8
8
  key: 'csharp',
9
9
  title: 'C#',
10
10
  extname: '.cs',
11
- "default": 'restsharp'
11
+ default: 'restsharp',
12
12
  },
13
13
  clientsById: {
14
14
  httpclient: client_1.httpclient,
15
- restsharp: client_2.restsharp
16
- }
15
+ restsharp: client_2.restsharp,
16
+ },
17
17
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.native = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  exports.native = {
@@ -18,7 +18,7 @@ exports.native = {
18
18
  key: 'native',
19
19
  title: 'NewRequest',
20
20
  link: 'http://golang.org/pkg/net/http/#NewRequest',
21
- description: 'Golang HTTP client request'
21
+ description: 'Golang HTTP client request',
22
22
  },
23
23
  convert: function (_a, options) {
24
24
  var postData = _a.postData, method = _a.method, allHeaders = _a.allHeaders, fullUrl = _a.fullUrl;
@@ -109,5 +109,5 @@ exports.native = {
109
109
  push('}');
110
110
  }
111
111
  return join();
112
- }
112
+ },
113
113
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.go = void 0;
4
4
  var client_1 = require("./native/client");
5
5
  exports.go = {
@@ -7,9 +7,9 @@ exports.go = {
7
7
  key: 'go',
8
8
  title: 'Go',
9
9
  extname: '.go',
10
- "default": 'native'
10
+ default: 'native',
11
11
  },
12
12
  clientsById: {
13
- native: client_1.native
14
- }
13
+ native: client_1.native,
14
+ },
15
15
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.http11 = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  var CRLF = '\r\n';
@@ -24,7 +24,7 @@ exports.http11 = {
24
24
  key: 'http1.1',
25
25
  title: 'HTTP/1.1',
26
26
  link: 'https://tools.ietf.org/html/rfc7230',
27
- description: 'HTTP/1.1 request string in accordance with RFC 7230'
27
+ description: 'HTTP/1.1 request string in accordance with RFC 7230',
28
28
  },
29
29
  convert: function (_a, options) {
30
30
  var method = _a.method, fullUrl = _a.fullUrl, uriObj = _a.uriObj, httpVersion = _a.httpVersion, allHeaders = _a.allHeaders, postData = _a.postData;
@@ -65,5 +65,5 @@ exports.http11 = {
65
65
  // RFC 7230 Section 3. Message Format
66
66
  // Extra CRLF separating the headers from the body.
67
67
  return "".concat(headerSection).concat(CRLF).concat(messageBody);
68
- }
68
+ },
69
69
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.http = void 0;
4
4
  var client_1 = require("./http1.1/client");
5
5
  exports.http = {
@@ -7,9 +7,9 @@ exports.http = {
7
7
  key: 'http',
8
8
  title: 'HTTP',
9
9
  extname: null,
10
- "default": '1.1'
10
+ default: '1.1',
11
11
  },
12
12
  clientsById: {
13
- 'http1.1': client_1.http11
14
- }
13
+ 'http1.1': client_1.http11,
14
+ },
15
15
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.asynchttp = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  exports.asynchttp = {
@@ -18,7 +18,7 @@ exports.asynchttp = {
18
18
  key: 'asynchttp',
19
19
  title: 'AsyncHttp',
20
20
  link: 'https://github.com/AsyncHttpClient/async-http-client',
21
- description: 'Asynchronous Http and WebSocket Client library for Java'
21
+ description: 'Asynchronous Http and WebSocket Client library for Java',
22
22
  },
23
23
  convert: function (_a, options) {
24
24
  var method = _a.method, allHeaders = _a.allHeaders, postData = _a.postData, fullUrl = _a.fullUrl;
@@ -40,5 +40,5 @@ exports.asynchttp = {
40
40
  blank();
41
41
  push('client.close();');
42
42
  return join();
43
- }
43
+ },
44
44
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.nethttp = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  exports.nethttp = {
@@ -18,7 +18,7 @@ exports.nethttp = {
18
18
  key: 'nethttp',
19
19
  title: 'java.net.http',
20
20
  link: 'https://openjdk.java.net/groups/net/httpclient/intro.html',
21
- description: 'Java Standardized HTTP Client API'
21
+ description: 'Java Standardized HTTP Client API',
22
22
  },
23
23
  convert: function (_a, options) {
24
24
  var allHeaders = _a.allHeaders, fullUrl = _a.fullUrl, method = _a.method, postData = _a.postData;
@@ -39,5 +39,5 @@ exports.nethttp = {
39
39
  push('HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());');
40
40
  push('System.out.println(response.body());');
41
41
  return join();
42
- }
42
+ },
43
43
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.okhttp = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  exports.okhttp = {
@@ -18,7 +18,7 @@ exports.okhttp = {
18
18
  key: 'okhttp',
19
19
  title: 'OkHttp',
20
20
  link: 'http://square.github.io/okhttp/',
21
- description: 'An HTTP Request Client Library'
21
+ description: 'An HTTP Request Client Library',
22
22
  },
23
23
  convert: function (_a, options) {
24
24
  var postData = _a.postData, method = _a.method, fullUrl = _a.fullUrl, allHeaders = _a.allHeaders;
@@ -66,5 +66,5 @@ exports.okhttp = {
66
66
  blank();
67
67
  push('Response response = client.newCall(request).execute();');
68
68
  return join();
69
- }
69
+ },
70
70
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.java = void 0;
4
4
  var client_1 = require("./asynchttp/client");
5
5
  var client_2 = require("./nethttp/client");
@@ -10,12 +10,12 @@ exports.java = {
10
10
  key: 'java',
11
11
  title: 'Java',
12
12
  extname: '.java',
13
- "default": 'unirest'
13
+ default: 'unirest',
14
14
  },
15
15
  clientsById: {
16
16
  asynchttp: client_1.asynchttp,
17
17
  nethttp: client_2.nethttp,
18
18
  okhttp: client_3.okhttp,
19
- unirest: client_4.unirest
20
- }
19
+ unirest: client_4.unirest,
20
+ },
21
21
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.unirest = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  exports.unirest = {
@@ -18,7 +18,7 @@ exports.unirest = {
18
18
  key: 'unirest',
19
19
  title: 'Unirest',
20
20
  link: 'http://unirest.io/java.html',
21
- description: 'Lightweight HTTP Request Client Library'
21
+ description: 'Lightweight HTTP Request Client Library',
22
22
  },
23
23
  convert: function (_a, options) {
24
24
  var method = _a.method, allHeaders = _a.allHeaders, postData = _a.postData, fullUrl = _a.fullUrl;
@@ -40,5 +40,5 @@ exports.unirest = {
40
40
  }
41
41
  push('.asString();', 1);
42
42
  return join();
43
- }
43
+ },
44
44
  };
@@ -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 allHeaders = _a.allHeaders, method = _a.method, url = _a.url, queryObj = _a.queryObj, postData = _a.postData;
@@ -32,7 +32,7 @@ exports.axios = {
32
32
  blank();
33
33
  var requestOptions = {
34
34
  method: method,
35
- url: url
35
+ url: url,
36
36
  };
37
37
  if (Object.keys(queryObj).length) {
38
38
  requestOptions.params = queryObj;
@@ -73,9 +73,9 @@ exports.axios = {
73
73
  requestOptions.data = postData.text;
74
74
  }
75
75
  }
76
- var optionString = (0, stringify_object_1["default"])(requestOptions, {
76
+ var optionString = (0, stringify_object_1.default)(requestOptions, {
77
77
  indent: ' ',
78
- inlineCharacterLimit: 80
78
+ inlineCharacterLimit: 80,
79
79
  }).replace('"[form]"', 'form');
80
80
  push("const options = ".concat(optionString, ";"));
81
81
  blank();
@@ -88,5 +88,5 @@ exports.axios = {
88
88
  push('console.error(error);', 2);
89
89
  push('});', 1);
90
90
  return join();
91
- }
91
+ },
92
92
  };