@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
@@ -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.httpie = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  var shell_1 = require("../../../helpers/shell");
@@ -19,7 +19,7 @@ exports.httpie = {
19
19
  key: 'httpie',
20
20
  title: 'HTTPie',
21
21
  link: 'http://httpie.org/',
22
- description: 'a CLI, cURL-like tool for humans'
22
+ description: 'a CLI, cURL-like tool for humans',
23
23
  },
24
24
  convert: function (_a, options) {
25
25
  var allHeaders = _a.allHeaders, postData = _a.postData, queryObj = _a.queryObj, fullUrl = _a.fullUrl, method = _a.method, url = _a.url;
@@ -27,7 +27,7 @@ exports.httpie = {
27
27
  var _b = new code_builder_1.CodeBuilder({
28
28
  indent: opts.indent,
29
29
  // @ts-expect-error SEEMS LEGIT
30
- join: opts.indent !== false ? " \\\n".concat(opts.indent) : ' '
30
+ join: opts.indent !== false ? " \\\n".concat(opts.indent) : ' ',
31
31
  }), push = _b.push, join = _b.join, unshift = _b.unshift;
32
32
  var raw = false;
33
33
  var flags = [];
@@ -98,5 +98,5 @@ exports.httpie = {
98
98
  unshift("echo ".concat(postDataText, " | "));
99
99
  }
100
100
  return join();
101
- }
101
+ },
102
102
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shell = void 0;
4
4
  var client_1 = require("./curl/client");
5
5
  var client_2 = require("./httpie/client");
@@ -9,12 +9,12 @@ exports.shell = {
9
9
  key: 'shell',
10
10
  title: 'Shell',
11
11
  extname: '.sh',
12
- "default": 'curl',
13
- cli: '%s'
12
+ default: 'curl',
13
+ cli: '%s',
14
14
  },
15
15
  clientsById: {
16
16
  curl: client_1.curl,
17
17
  httpie: client_2.httpie,
18
- wget: client_3.wget
19
- }
18
+ wget: client_3.wget,
19
+ },
20
20
  };
@@ -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.wget = void 0;
15
15
  var code_builder_1 = require("../../../helpers/code-builder");
16
16
  var shell_1 = require("../../../helpers/shell");
@@ -19,7 +19,7 @@ exports.wget = {
19
19
  key: 'wget',
20
20
  title: 'Wget',
21
21
  link: 'https://www.gnu.org/software/wget/',
22
- description: 'a free software package for retrieving files using HTTP, HTTPS'
22
+ description: 'a free software package for retrieving files using HTTP, HTTPS',
23
23
  },
24
24
  convert: function (_a, options) {
25
25
  var method = _a.method, postData = _a.postData, allHeaders = _a.allHeaders, fullUrl = _a.fullUrl;
@@ -42,5 +42,5 @@ exports.wget = {
42
42
  push(opts.short ? '-O' : '--output-document');
43
43
  push("- ".concat((0, shell_1.quote)(fullUrl)));
44
44
  return join();
45
- }
45
+ },
46
46
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.literalRepresentation = exports.literalDeclaration = void 0;
4
4
  /**
5
5
  * Create an string of given length filled with blank spaces
@@ -26,7 +26,7 @@ var __read = (this && this.__read) || function (o, n) {
26
26
  }
27
27
  return ar;
28
28
  };
29
- exports.__esModule = true;
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.nsurlsession = void 0;
31
31
  var code_builder_1 = require("../../../helpers/code-builder");
32
32
  var helpers_1 = require("../helpers");
@@ -35,7 +35,7 @@ exports.nsurlsession = {
35
35
  key: 'nsurlsession',
36
36
  title: 'NSURLSession',
37
37
  link: 'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',
38
- description: "Foundation's NSURLSession request"
38
+ description: "Foundation's NSURLSession request",
39
39
  },
40
40
  convert: function (_a, options) {
41
41
  var allHeaders = _a.allHeaders, postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method;
@@ -44,7 +44,7 @@ exports.nsurlsession = {
44
44
  // Markers for headers to be created as litteral objects and later be set on the NSURLRequest if exist
45
45
  var req = {
46
46
  hasHeaders: false,
47
- hasBody: false
47
+ hasBody: false,
48
48
  };
49
49
  // We just want to make sure people understand that is the only dependency
50
50
  push('import Foundation');
@@ -143,5 +143,5 @@ exports.nsurlsession = {
143
143
  blank();
144
144
  push('dataTask.resume()');
145
145
  return join();
146
- }
146
+ },
147
147
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.swift = void 0;
4
4
  var client_1 = require("./nsurlsession/client");
5
5
  exports.swift = {
@@ -7,9 +7,9 @@ exports.swift = {
7
7
  key: 'swift',
8
8
  title: 'Swift',
9
9
  extname: '.swift',
10
- "default": 'nsurlsession'
10
+ default: 'nsurlsession',
11
11
  },
12
12
  clientsById: {
13
- nsurlsession: client_1.nsurlsession
14
- }
13
+ nsurlsession: client_1.nsurlsession,
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.addTargetClient = exports.isClient = exports.addTarget = exports.isTarget = exports.targets = void 0;
4
4
  var target_1 = require("./c/target");
5
5
  var target_2 = require("./clojure/target");
@@ -37,7 +37,7 @@ exports.targets = {
37
37
  r: target_15.r,
38
38
  ruby: target_16.ruby,
39
39
  shell: target_17.shell,
40
- swift: target_18.swift
40
+ swift: target_18.swift,
41
41
  };
42
42
  var isTarget = function (target) {
43
43
  if (typeof target !== 'object' || target === null || Array.isArray(target)) {
@@ -73,8 +73,8 @@ var isTarget = function (target) {
73
73
  if (!Object.prototype.hasOwnProperty.call(target.info, 'default')) {
74
74
  throw new Error('targets must have an `info` object with the property `default`');
75
75
  }
76
- if (!Object.prototype.hasOwnProperty.call(target.clientsById, target.info["default"])) {
77
- throw new Error("target ".concat(target.info.key, " is configured with a default client ").concat(target.info["default"], ", but no such client was found in the property `clientsById` (found ").concat(JSON.stringify(Object.keys(target.clientsById)), ")"));
76
+ if (!Object.prototype.hasOwnProperty.call(target.clientsById, target.info.default)) {
77
+ throw new Error("target ".concat(target.info.key, " is configured with a default client ").concat(target.info.default, ", but no such client was found in the property `clientsById` (found ").concat(JSON.stringify(Object.keys(target.clientsById)), ")"));
78
78
  }
79
79
  Object.values(target.clientsById).forEach(exports.isClient);
80
80
  return true;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.1.0",
2
+ "version": "6.0.0",
3
3
  "name": "@readme/httpsnippet",
4
4
  "description": "HTTP Request snippet generator for *most* languages",
5
5
  "homepage": "https://github.com/readmeio/httpsnippet",
@@ -37,7 +37,7 @@
37
37
  "xmlhttprequest"
38
38
  ],
39
39
  "engines": {
40
- "node": ">=14"
40
+ "node": ">=16"
41
41
  },
42
42
  "files": [
43
43
  "dist"
@@ -57,26 +57,26 @@
57
57
  "test": "jest --coverage"
58
58
  },
59
59
  "devDependencies": {
60
- "@readme/eslint-config": "^10.5.1",
61
- "@types/eslint": "^8.21.1",
62
- "@types/event-stream": "^4.0.0",
60
+ "@readme/eslint-config": "^10.5.3",
61
+ "@types/eslint": "^8.40.0",
62
+ "@types/event-stream": "^4.0.1",
63
63
  "@types/har-format": "^1.2.8",
64
- "@types/jest": "^28.1.6",
65
- "@types/node": "^18.14.4",
64
+ "@types/jest": "^29.5.2",
65
+ "@types/node": "^20.2.5",
66
66
  "@types/qs": "^6.9.7",
67
67
  "@types/stringify-object": "^4.0.2",
68
- "eslint": "^8.35.0",
69
- "jest": "^28.0.3",
70
- "prettier": "^2.8.4",
68
+ "eslint": "^8.41.0",
69
+ "jest": "^29.5.0",
70
+ "prettier": "^2.8.8",
71
71
  "require-directory": "^2.1.1",
72
- "ts-jest": "^28.0.5",
73
- "type-fest": "^3.6.1",
74
- "typescript": "^4.9.5"
72
+ "ts-jest": "^29.1.0",
73
+ "type-fest": "^3.11.1",
74
+ "typescript": "^5.1.3"
75
75
  },
76
76
  "dependencies": {
77
77
  "event-stream": "4.0.1",
78
78
  "form-data": "^4.0.0",
79
- "qs": "^6.10.1",
79
+ "qs": "^6.11.2",
80
80
  "stringify-object": "^3.3.0"
81
81
  },
82
82
  "prettier": "@readme/eslint-config/prettier"