@readme/httpsnippet 6.2.1 → 7.0.1

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 (494) hide show
  1. package/dist/chunk-XPUGYZ4Y.mjs +3485 -0
  2. package/dist/chunk-XPUGYZ4Y.mjs.map +1 -0
  3. package/dist/index-acc66e3d.d.ts +167 -0
  4. package/dist/index.d.mts +4 -0
  5. package/dist/index.d.ts +4 -95
  6. package/dist/index.js +3777 -261
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.mjs +299 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/targets/targets.d.mts +4 -0
  11. package/dist/targets/targets.d.ts +4 -53
  12. package/dist/targets/targets.js +3476 -113
  13. package/dist/targets/targets.js.map +1 -0
  14. package/dist/targets/targets.mjs +3 -0
  15. package/dist/targets/targets.mjs.map +1 -0
  16. package/package.json +40 -14
  17. package/dist/helpers/code-builder.d.ts +0 -49
  18. package/dist/helpers/code-builder.js +0 -91
  19. package/dist/helpers/escape.d.ts +0 -46
  20. package/dist/helpers/escape.js +0 -101
  21. package/dist/helpers/form-data.d.ts +0 -30
  22. package/dist/helpers/form-data.js +0 -157
  23. package/dist/helpers/headers.d.ts +0 -18
  24. package/dist/helpers/headers.js +0 -33
  25. package/dist/helpers/reducer.d.ts +0 -5
  26. package/dist/helpers/reducer.js +0 -19
  27. package/dist/helpers/shell.d.ts +0 -6
  28. package/dist/helpers/shell.js +0 -20
  29. package/dist/helpers/utils.d.ts +0 -6
  30. package/dist/helpers/utils.js +0 -21
  31. package/dist/targets/c/libcurl/client.d.ts +0 -2
  32. package/dist/targets/c/libcurl/client.js +0 -45
  33. package/dist/targets/c/target.d.ts +0 -2
  34. package/dist/targets/c/target.js +0 -16
  35. package/dist/targets/clojure/clj_http/client.d.ts +0 -11
  36. package/dist/targets/clojure/clj_http/client.js +0 -178
  37. package/dist/targets/clojure/target.d.ts +0 -2
  38. package/dist/targets/clojure/target.js +0 -15
  39. package/dist/targets/csharp/httpclient/client.d.ts +0 -2
  40. package/dist/targets/csharp/httpclient/client.js +0 -163
  41. package/dist/targets/csharp/restsharp/client.d.ts +0 -2
  42. package/dist/targets/csharp/restsharp/client.js +0 -92
  43. package/dist/targets/csharp/target.d.ts +0 -2
  44. package/dist/targets/csharp/target.js +0 -18
  45. package/dist/targets/go/native/client.d.ts +0 -17
  46. package/dist/targets/go/native/client.js +0 -103
  47. package/dist/targets/go/target.d.ts +0 -2
  48. package/dist/targets/go/target.js +0 -16
  49. package/dist/targets/http/http1.1/client.d.ts +0 -23
  50. package/dist/targets/http/http1.1/client.js +0 -69
  51. package/dist/targets/http/target.d.ts +0 -2
  52. package/dist/targets/http/target.js +0 -15
  53. package/dist/targets/java/asynchttp/client.d.ts +0 -11
  54. package/dist/targets/java/asynchttp/client.js +0 -45
  55. package/dist/targets/java/nethttp/client.d.ts +0 -14
  56. package/dist/targets/java/nethttp/client.js +0 -44
  57. package/dist/targets/java/okhttp/client.d.ts +0 -11
  58. package/dist/targets/java/okhttp/client.js +0 -71
  59. package/dist/targets/java/target.d.ts +0 -2
  60. package/dist/targets/java/target.js +0 -21
  61. package/dist/targets/java/unirest/client.d.ts +0 -11
  62. package/dist/targets/java/unirest/client.js +0 -45
  63. package/dist/targets/javascript/axios/client.d.ts +0 -11
  64. package/dist/targets/javascript/axios/client.js +0 -92
  65. package/dist/targets/javascript/axios/fixtures/application-form-encoded.d.ts +0 -1
  66. package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +0 -23
  67. package/dist/targets/javascript/axios/fixtures/application-json.d.ts +0 -1
  68. package/dist/targets/javascript/axios/fixtures/application-json.js +0 -27
  69. package/dist/targets/javascript/axios/fixtures/cookies.d.ts +0 -1
  70. package/dist/targets/javascript/axios/fixtures/cookies.js +0 -19
  71. package/dist/targets/javascript/axios/fixtures/custom-method.d.ts +0 -1
  72. package/dist/targets/javascript/axios/fixtures/custom-method.js +0 -15
  73. package/dist/targets/javascript/axios/fixtures/full.d.ts +0 -1
  74. package/dist/targets/javascript/axios/fixtures/full.js +0 -27
  75. package/dist/targets/javascript/axios/fixtures/headers.d.ts +0 -1
  76. package/dist/targets/javascript/axios/fixtures/headers.js +0 -24
  77. package/dist/targets/javascript/axios/fixtures/http-insecure.d.ts +0 -1
  78. package/dist/targets/javascript/axios/fixtures/http-insecure.js +0 -15
  79. package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.d.ts +0 -1
  80. package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +0 -20
  81. package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.d.ts +0 -1
  82. package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +0 -20
  83. package/dist/targets/javascript/axios/fixtures/multipart-data.d.ts +0 -1
  84. package/dist/targets/javascript/axios/fixtures/multipart-data.js +0 -23
  85. package/dist/targets/javascript/axios/fixtures/multipart-file.d.ts +0 -1
  86. package/dist/targets/javascript/axios/fixtures/multipart-file.js +0 -22
  87. package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
  88. package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +0 -19
  89. package/dist/targets/javascript/axios/fixtures/multipart-form-data.d.ts +0 -1
  90. package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +0 -22
  91. package/dist/targets/javascript/axios/fixtures/nested.d.ts +0 -1
  92. package/dist/targets/javascript/axios/fixtures/nested.js +0 -19
  93. package/dist/targets/javascript/axios/fixtures/postdata-malformed.d.ts +0 -1
  94. package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +0 -19
  95. package/dist/targets/javascript/axios/fixtures/query-encoded.d.ts +0 -1
  96. package/dist/targets/javascript/axios/fixtures/query-encoded.js +0 -22
  97. package/dist/targets/javascript/axios/fixtures/query.d.ts +0 -1
  98. package/dist/targets/javascript/axios/fixtures/query.js +0 -19
  99. package/dist/targets/javascript/axios/fixtures/short.d.ts +0 -1
  100. package/dist/targets/javascript/axios/fixtures/short.js +0 -15
  101. package/dist/targets/javascript/axios/fixtures/text-plain.d.ts +0 -1
  102. package/dist/targets/javascript/axios/fixtures/text-plain.js +0 -20
  103. package/dist/targets/javascript/fetch/client.d.ts +0 -15
  104. package/dist/targets/javascript/fetch/client.js +0 -106
  105. package/dist/targets/javascript/fetch/fixtures/application-form-encoded.d.ts +0 -8
  106. package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +0 -10
  107. package/dist/targets/javascript/fetch/fixtures/application-json.d.ts +0 -7
  108. package/dist/targets/javascript/fetch/fixtures/application-json.js +0 -17
  109. package/dist/targets/javascript/fetch/fixtures/cookies.d.ts +0 -6
  110. package/dist/targets/javascript/fetch/fixtures/cookies.js +0 -6
  111. package/dist/targets/javascript/fetch/fixtures/custom-method.d.ts +0 -3
  112. package/dist/targets/javascript/fetch/fixtures/custom-method.js +0 -6
  113. package/dist/targets/javascript/fetch/fixtures/full.d.ts +0 -10
  114. package/dist/targets/javascript/fetch/fixtures/full.js +0 -14
  115. package/dist/targets/javascript/fetch/fixtures/headers.d.ts +0 -9
  116. package/dist/targets/javascript/fetch/fixtures/headers.js +0 -14
  117. package/dist/targets/javascript/fetch/fixtures/http-insecure.d.ts +0 -3
  118. package/dist/targets/javascript/fetch/fixtures/http-insecure.js +0 -6
  119. package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.d.ts +0 -7
  120. package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +0 -10
  121. package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.d.ts +0 -7
  122. package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +0 -10
  123. package/dist/targets/javascript/fetch/fixtures/multipart-data.d.ts +0 -4
  124. package/dist/targets/javascript/fetch/fixtures/multipart-data.js +0 -10
  125. package/dist/targets/javascript/fetch/fixtures/multipart-file.d.ts +0 -4
  126. package/dist/targets/javascript/fetch/fixtures/multipart-file.js +0 -9
  127. package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -6
  128. package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +0 -6
  129. package/dist/targets/javascript/fetch/fixtures/multipart-form-data.d.ts +0 -4
  130. package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +0 -9
  131. package/dist/targets/javascript/fetch/fixtures/nested.d.ts +0 -3
  132. package/dist/targets/javascript/fetch/fixtures/nested.js +0 -6
  133. package/dist/targets/javascript/fetch/fixtures/postdata-malformed.d.ts +0 -6
  134. package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +0 -6
  135. package/dist/targets/javascript/fetch/fixtures/query-encoded.d.ts +0 -3
  136. package/dist/targets/javascript/fetch/fixtures/query-encoded.js +0 -6
  137. package/dist/targets/javascript/fetch/fixtures/query.d.ts +0 -3
  138. package/dist/targets/javascript/fetch/fixtures/query.js +0 -6
  139. package/dist/targets/javascript/fetch/fixtures/short.d.ts +0 -3
  140. package/dist/targets/javascript/fetch/fixtures/short.js +0 -6
  141. package/dist/targets/javascript/fetch/fixtures/text-plain.d.ts +0 -7
  142. package/dist/targets/javascript/fetch/fixtures/text-plain.js +0 -6
  143. package/dist/targets/javascript/jquery/client.d.ts +0 -11
  144. package/dist/targets/javascript/jquery/client.js +0 -84
  145. package/dist/targets/javascript/jquery/fixtures/application-form-encoded.d.ts +0 -13
  146. package/dist/targets/javascript/jquery/fixtures/application-form-encoded.js +0 -17
  147. package/dist/targets/javascript/jquery/fixtures/application-json.d.ts +0 -11
  148. package/dist/targets/javascript/jquery/fixtures/application-json.js +0 -15
  149. package/dist/targets/javascript/jquery/fixtures/cookies.d.ts +0 -9
  150. package/dist/targets/javascript/jquery/fixtures/cookies.js +0 -13
  151. package/dist/targets/javascript/jquery/fixtures/custom-method.d.ts +0 -7
  152. package/dist/targets/javascript/jquery/fixtures/custom-method.js +0 -11
  153. package/dist/targets/javascript/jquery/fixtures/full.d.ts +0 -14
  154. package/dist/targets/javascript/jquery/fixtures/full.js +0 -18
  155. package/dist/targets/javascript/jquery/fixtures/headers.d.ts +0 -12
  156. package/dist/targets/javascript/jquery/fixtures/headers.js +0 -16
  157. package/dist/targets/javascript/jquery/fixtures/http-insecure.d.ts +0 -7
  158. package/dist/targets/javascript/jquery/fixtures/http-insecure.js +0 -11
  159. package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.d.ts +0 -11
  160. package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.js +0 -15
  161. package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.d.ts +0 -11
  162. package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.js +0 -15
  163. package/dist/targets/javascript/jquery/fixtures/multipart-data.d.ts +0 -12
  164. package/dist/targets/javascript/jquery/fixtures/multipart-data.js +0 -18
  165. package/dist/targets/javascript/jquery/fixtures/multipart-file.d.ts +0 -12
  166. package/dist/targets/javascript/jquery/fixtures/multipart-file.js +0 -17
  167. package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.d.ts +0 -9
  168. package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +0 -13
  169. package/dist/targets/javascript/jquery/fixtures/multipart-form-data.d.ts +0 -12
  170. package/dist/targets/javascript/jquery/fixtures/multipart-form-data.js +0 -17
  171. package/dist/targets/javascript/jquery/fixtures/nested.d.ts +0 -7
  172. package/dist/targets/javascript/jquery/fixtures/nested.js +0 -11
  173. package/dist/targets/javascript/jquery/fixtures/postdata-malformed.d.ts +0 -9
  174. package/dist/targets/javascript/jquery/fixtures/postdata-malformed.js +0 -13
  175. package/dist/targets/javascript/jquery/fixtures/query-encoded.d.ts +0 -7
  176. package/dist/targets/javascript/jquery/fixtures/query-encoded.js +0 -11
  177. package/dist/targets/javascript/jquery/fixtures/query.d.ts +0 -7
  178. package/dist/targets/javascript/jquery/fixtures/query.js +0 -11
  179. package/dist/targets/javascript/jquery/fixtures/short.d.ts +0 -7
  180. package/dist/targets/javascript/jquery/fixtures/short.js +0 -11
  181. package/dist/targets/javascript/jquery/fixtures/text-plain.d.ts +0 -10
  182. package/dist/targets/javascript/jquery/fixtures/text-plain.js +0 -14
  183. package/dist/targets/javascript/target.d.ts +0 -2
  184. package/dist/targets/javascript/target.js +0 -21
  185. package/dist/targets/javascript/xhr/client.d.ts +0 -14
  186. package/dist/targets/javascript/xhr/client.js +0 -83
  187. package/dist/targets/javascript/xhr/fixtures/application-form-encoded.d.ts +0 -2
  188. package/dist/targets/javascript/xhr/fixtures/application-form-encoded.js +0 -12
  189. package/dist/targets/javascript/xhr/fixtures/application-json.d.ts +0 -2
  190. package/dist/targets/javascript/xhr/fixtures/application-json.js +0 -31
  191. package/dist/targets/javascript/xhr/fixtures/cookies.d.ts +0 -2
  192. package/dist/targets/javascript/xhr/fixtures/cookies.js +0 -12
  193. package/dist/targets/javascript/xhr/fixtures/cors.d.ts +0 -2
  194. package/dist/targets/javascript/xhr/fixtures/cors.js +0 -10
  195. package/dist/targets/javascript/xhr/fixtures/custom-method.d.ts +0 -2
  196. package/dist/targets/javascript/xhr/fixtures/custom-method.js +0 -11
  197. package/dist/targets/javascript/xhr/fixtures/full.d.ts +0 -2
  198. package/dist/targets/javascript/xhr/fixtures/full.js +0 -14
  199. package/dist/targets/javascript/xhr/fixtures/headers.d.ts +0 -2
  200. package/dist/targets/javascript/xhr/fixtures/headers.js +0 -15
  201. package/dist/targets/javascript/xhr/fixtures/http-insecure.d.ts +0 -2
  202. package/dist/targets/javascript/xhr/fixtures/http-insecure.js +0 -11
  203. package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.d.ts +0 -2
  204. package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.js +0 -14
  205. package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.d.ts +0 -2
  206. package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.js +0 -14
  207. package/dist/targets/javascript/xhr/fixtures/multipart-data.d.ts +0 -2
  208. package/dist/targets/javascript/xhr/fixtures/multipart-data.js +0 -13
  209. package/dist/targets/javascript/xhr/fixtures/multipart-file.d.ts +0 -2
  210. package/dist/targets/javascript/xhr/fixtures/multipart-file.js +0 -12
  211. package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.d.ts +0 -1
  212. package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +0 -11
  213. package/dist/targets/javascript/xhr/fixtures/multipart-form-data.d.ts +0 -2
  214. package/dist/targets/javascript/xhr/fixtures/multipart-form-data.js +0 -12
  215. package/dist/targets/javascript/xhr/fixtures/nested.d.ts +0 -2
  216. package/dist/targets/javascript/xhr/fixtures/nested.js +0 -11
  217. package/dist/targets/javascript/xhr/fixtures/postdata-malformed.d.ts +0 -2
  218. package/dist/targets/javascript/xhr/fixtures/postdata-malformed.js +0 -12
  219. package/dist/targets/javascript/xhr/fixtures/query-encoded.d.ts +0 -2
  220. package/dist/targets/javascript/xhr/fixtures/query-encoded.js +0 -11
  221. package/dist/targets/javascript/xhr/fixtures/query.d.ts +0 -2
  222. package/dist/targets/javascript/xhr/fixtures/query.js +0 -11
  223. package/dist/targets/javascript/xhr/fixtures/short.d.ts +0 -2
  224. package/dist/targets/javascript/xhr/fixtures/short.js +0 -11
  225. package/dist/targets/javascript/xhr/fixtures/text-plain.d.ts +0 -2
  226. package/dist/targets/javascript/xhr/fixtures/text-plain.js +0 -12
  227. package/dist/targets/json/native/client.d.ts +0 -2
  228. package/dist/targets/json/native/client.js +0 -56
  229. package/dist/targets/json/target.d.ts +0 -2
  230. package/dist/targets/json/target.js +0 -15
  231. package/dist/targets/kotlin/okhttp/client.d.ts +0 -11
  232. package/dist/targets/kotlin/okhttp/client.js +0 -71
  233. package/dist/targets/kotlin/target.d.ts +0 -2
  234. package/dist/targets/kotlin/target.js +0 -15
  235. package/dist/targets/node/axios/client.d.ts +0 -11
  236. package/dist/targets/node/axios/client.js +0 -78
  237. package/dist/targets/node/axios/fixtures/application-form-encoded.d.ts +0 -1
  238. package/dist/targets/node/axios/fixtures/application-form-encoded.js +0 -20
  239. package/dist/targets/node/axios/fixtures/application-json.d.ts +0 -1
  240. package/dist/targets/node/axios/fixtures/application-json.js +0 -23
  241. package/dist/targets/node/axios/fixtures/cookies.d.ts +0 -1
  242. package/dist/targets/node/axios/fixtures/cookies.js +0 -15
  243. package/dist/targets/node/axios/fixtures/custom-method.d.ts +0 -1
  244. package/dist/targets/node/axios/fixtures/custom-method.js +0 -11
  245. package/dist/targets/node/axios/fixtures/full.d.ts +0 -1
  246. package/dist/targets/node/axios/fixtures/full.js +0 -23
  247. package/dist/targets/node/axios/fixtures/headers.d.ts +0 -1
  248. package/dist/targets/node/axios/fixtures/headers.js +0 -20
  249. package/dist/targets/node/axios/fixtures/http-insecure.d.ts +0 -1
  250. package/dist/targets/node/axios/fixtures/http-insecure.js +0 -11
  251. package/dist/targets/node/axios/fixtures/jsonObj-multiline.d.ts +0 -1
  252. package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +0 -16
  253. package/dist/targets/node/axios/fixtures/jsonObj-null-value.d.ts +0 -1
  254. package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +0 -16
  255. package/dist/targets/node/axios/fixtures/multipart-data.d.ts +0 -1
  256. package/dist/targets/node/axios/fixtures/multipart-data.js +0 -16
  257. package/dist/targets/node/axios/fixtures/multipart-file.d.ts +0 -1
  258. package/dist/targets/node/axios/fixtures/multipart-file.js +0 -16
  259. package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
  260. package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +0 -15
  261. package/dist/targets/node/axios/fixtures/multipart-form-data.d.ts +0 -1
  262. package/dist/targets/node/axios/fixtures/multipart-form-data.js +0 -16
  263. package/dist/targets/node/axios/fixtures/nested.d.ts +0 -1
  264. package/dist/targets/node/axios/fixtures/nested.js +0 -14
  265. package/dist/targets/node/axios/fixtures/postdata-malformed.d.ts +0 -1
  266. package/dist/targets/node/axios/fixtures/postdata-malformed.js +0 -15
  267. package/dist/targets/node/axios/fixtures/query-encoded.d.ts +0 -1
  268. package/dist/targets/node/axios/fixtures/query-encoded.js +0 -14
  269. package/dist/targets/node/axios/fixtures/query.d.ts +0 -1
  270. package/dist/targets/node/axios/fixtures/query.js +0 -14
  271. package/dist/targets/node/axios/fixtures/short.d.ts +0 -1
  272. package/dist/targets/node/axios/fixtures/short.js +0 -11
  273. package/dist/targets/node/axios/fixtures/text-plain.d.ts +0 -1
  274. package/dist/targets/node/axios/fixtures/text-plain.js +0 -16
  275. package/dist/targets/node/fetch/client.d.ts +0 -11
  276. package/dist/targets/node/fetch/client.js +0 -140
  277. package/dist/targets/node/fetch/fixtures/application-form-encoded.d.ts +0 -1
  278. package/dist/targets/node/fetch/fixtures/application-form-encoded.js +0 -16
  279. package/dist/targets/node/fetch/fixtures/application-json.d.ts +0 -1
  280. package/dist/targets/node/fetch/fixtures/application-json.js +0 -19
  281. package/dist/targets/node/fetch/fixtures/cookies.d.ts +0 -1
  282. package/dist/targets/node/fetch/fixtures/cookies.js +0 -8
  283. package/dist/targets/node/fetch/fixtures/custom-method.d.ts +0 -1
  284. package/dist/targets/node/fetch/fixtures/custom-method.js +0 -8
  285. package/dist/targets/node/fetch/fixtures/full.d.ts +0 -1
  286. package/dist/targets/node/fetch/fixtures/full.js +0 -19
  287. package/dist/targets/node/fetch/fixtures/headers.d.ts +0 -1
  288. package/dist/targets/node/fetch/fixtures/headers.js +0 -16
  289. package/dist/targets/node/fetch/fixtures/http-insecure.d.ts +0 -1
  290. package/dist/targets/node/fetch/fixtures/http-insecure.js +0 -8
  291. package/dist/targets/node/fetch/fixtures/jsonObj-multiline.d.ts +0 -1
  292. package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +0 -12
  293. package/dist/targets/node/fetch/fixtures/jsonObj-null-value.d.ts +0 -1
  294. package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +0 -12
  295. package/dist/targets/node/fetch/fixtures/multipart-data.d.ts +0 -1
  296. package/dist/targets/node/fetch/fixtures/multipart-data.js +0 -14
  297. package/dist/targets/node/fetch/fixtures/multipart-file.d.ts +0 -1
  298. package/dist/targets/node/fetch/fixtures/multipart-file.js +0 -13
  299. package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -1
  300. package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +0 -8
  301. package/dist/targets/node/fetch/fixtures/multipart-form-data.d.ts +0 -1
  302. package/dist/targets/node/fetch/fixtures/multipart-form-data.js +0 -12
  303. package/dist/targets/node/fetch/fixtures/nested.d.ts +0 -1
  304. package/dist/targets/node/fetch/fixtures/nested.js +0 -8
  305. package/dist/targets/node/fetch/fixtures/postdata-malformed.d.ts +0 -1
  306. package/dist/targets/node/fetch/fixtures/postdata-malformed.js +0 -8
  307. package/dist/targets/node/fetch/fixtures/query-encoded.d.ts +0 -1
  308. package/dist/targets/node/fetch/fixtures/query-encoded.js +0 -8
  309. package/dist/targets/node/fetch/fixtures/query.d.ts +0 -1
  310. package/dist/targets/node/fetch/fixtures/query.js +0 -8
  311. package/dist/targets/node/fetch/fixtures/short.d.ts +0 -1
  312. package/dist/targets/node/fetch/fixtures/short.js +0 -8
  313. package/dist/targets/node/fetch/fixtures/text-plain.d.ts +0 -1
  314. package/dist/targets/node/fetch/fixtures/text-plain.js +0 -8
  315. package/dist/targets/node/native/client.d.ts +0 -11
  316. package/dist/targets/node/native/client.js +0 -72
  317. package/dist/targets/node/native/fixtures/application-form-encoded.d.ts +0 -1
  318. package/dist/targets/node/native/fixtures/application-form-encoded.js +0 -24
  319. package/dist/targets/node/native/fixtures/application-json.d.ts +0 -1
  320. package/dist/targets/node/native/fixtures/application-json.js +0 -30
  321. package/dist/targets/node/native/fixtures/cookies.d.ts +0 -1
  322. package/dist/targets/node/native/fixtures/cookies.js +0 -22
  323. package/dist/targets/node/native/fixtures/custom-method.d.ts +0 -1
  324. package/dist/targets/node/native/fixtures/custom-method.js +0 -20
  325. package/dist/targets/node/native/fixtures/full.d.ts +0 -1
  326. package/dist/targets/node/native/fixtures/full.js +0 -26
  327. package/dist/targets/node/native/fixtures/headers.d.ts +0 -1
  328. package/dist/targets/node/native/fixtures/headers.js +0 -25
  329. package/dist/targets/node/native/fixtures/http-insecure.d.ts +0 -1
  330. package/dist/targets/node/native/fixtures/http-insecure.js +0 -20
  331. package/dist/targets/node/native/fixtures/jsonObj-multiline.d.ts +0 -1
  332. package/dist/targets/node/native/fixtures/jsonObj-multiline.js +0 -23
  333. package/dist/targets/node/native/fixtures/jsonObj-null-value.d.ts +0 -1
  334. package/dist/targets/node/native/fixtures/jsonObj-null-value.js +0 -23
  335. package/dist/targets/node/native/fixtures/multipart-data.d.ts +0 -1
  336. package/dist/targets/node/native/fixtures/multipart-data.js +0 -23
  337. package/dist/targets/node/native/fixtures/multipart-file.d.ts +0 -1
  338. package/dist/targets/node/native/fixtures/multipart-file.js +0 -23
  339. package/dist/targets/node/native/fixtures/multipart-form-data-no-params.d.ts +0 -1
  340. package/dist/targets/node/native/fixtures/multipart-form-data-no-params.js +0 -22
  341. package/dist/targets/node/native/fixtures/multipart-form-data.d.ts +0 -1
  342. package/dist/targets/node/native/fixtures/multipart-form-data.js +0 -23
  343. package/dist/targets/node/native/fixtures/nested.d.ts +0 -1
  344. package/dist/targets/node/native/fixtures/nested.js +0 -20
  345. package/dist/targets/node/native/fixtures/postdata-malformed.d.ts +0 -1
  346. package/dist/targets/node/native/fixtures/postdata-malformed.js +0 -22
  347. package/dist/targets/node/native/fixtures/query-encoded.d.ts +0 -1
  348. package/dist/targets/node/native/fixtures/query-encoded.js +0 -20
  349. package/dist/targets/node/native/fixtures/query.d.ts +0 -1
  350. package/dist/targets/node/native/fixtures/query.js +0 -20
  351. package/dist/targets/node/native/fixtures/short.d.ts +0 -1
  352. package/dist/targets/node/native/fixtures/short.js +0 -20
  353. package/dist/targets/node/native/fixtures/text-plain.d.ts +0 -1
  354. package/dist/targets/node/native/fixtures/text-plain.js +0 -23
  355. package/dist/targets/node/request/client.d.ts +0 -11
  356. package/dist/targets/node/request/client.js +0 -107
  357. package/dist/targets/node/request/fixtures/application-form-encoded.d.ts +0 -1
  358. package/dist/targets/node/request/fixtures/application-form-encoded.js +0 -13
  359. package/dist/targets/node/request/fixtures/application-json.d.ts +0 -1
  360. package/dist/targets/node/request/fixtures/application-json.js +0 -21
  361. package/dist/targets/node/request/fixtures/cookies.d.ts +0 -1
  362. package/dist/targets/node/request/fixtures/cookies.js +0 -11
  363. package/dist/targets/node/request/fixtures/custom-method.d.ts +0 -1
  364. package/dist/targets/node/request/fixtures/custom-method.js +0 -8
  365. package/dist/targets/node/request/fixtures/full.d.ts +0 -1
  366. package/dist/targets/node/request/fixtures/full.js +0 -20
  367. package/dist/targets/node/request/fixtures/headers.d.ts +0 -1
  368. package/dist/targets/node/request/fixtures/headers.js +0 -17
  369. package/dist/targets/node/request/fixtures/http-insecure.d.ts +0 -1
  370. package/dist/targets/node/request/fixtures/http-insecure.js +0 -8
  371. package/dist/targets/node/request/fixtures/jsonObj-multiline.d.ts +0 -1
  372. package/dist/targets/node/request/fixtures/jsonObj-multiline.js +0 -14
  373. package/dist/targets/node/request/fixtures/jsonObj-null-value.d.ts +0 -1
  374. package/dist/targets/node/request/fixtures/jsonObj-null-value.js +0 -14
  375. package/dist/targets/node/request/fixtures/multipart-data.d.ts +0 -1
  376. package/dist/targets/node/request/fixtures/multipart-data.js +0 -20
  377. package/dist/targets/node/request/fixtures/multipart-file.d.ts +0 -1
  378. package/dist/targets/node/request/fixtures/multipart-file.js +0 -19
  379. package/dist/targets/node/request/fixtures/multipart-form-data-no-params.d.ts +0 -1
  380. package/dist/targets/node/request/fixtures/multipart-form-data-no-params.js +0 -12
  381. package/dist/targets/node/request/fixtures/multipart-form-data.d.ts +0 -1
  382. package/dist/targets/node/request/fixtures/multipart-form-data.js +0 -13
  383. package/dist/targets/node/request/fixtures/nested.d.ts +0 -1
  384. package/dist/targets/node/request/fixtures/nested.js +0 -11
  385. package/dist/targets/node/request/fixtures/postdata-malformed.d.ts +0 -1
  386. package/dist/targets/node/request/fixtures/postdata-malformed.js +0 -12
  387. package/dist/targets/node/request/fixtures/query-encoded.d.ts +0 -1
  388. package/dist/targets/node/request/fixtures/query-encoded.js +0 -11
  389. package/dist/targets/node/request/fixtures/query.d.ts +0 -1
  390. package/dist/targets/node/request/fixtures/query.js +0 -11
  391. package/dist/targets/node/request/fixtures/short.d.ts +0 -1
  392. package/dist/targets/node/request/fixtures/short.js +0 -8
  393. package/dist/targets/node/request/fixtures/text-plain.d.ts +0 -1
  394. package/dist/targets/node/request/fixtures/text-plain.js +0 -13
  395. package/dist/targets/node/target.d.ts +0 -2
  396. package/dist/targets/node/target.js +0 -24
  397. package/dist/targets/node/unirest/client.d.ts +0 -11
  398. package/dist/targets/node/unirest/client.js +0 -110
  399. package/dist/targets/node/unirest/fixtures/application-form-encoded.d.ts +0 -1
  400. package/dist/targets/node/unirest/fixtures/application-form-encoded.js +0 -15
  401. package/dist/targets/node/unirest/fixtures/application-json.d.ts +0 -1
  402. package/dist/targets/node/unirest/fixtures/application-json.js +0 -32
  403. package/dist/targets/node/unirest/fixtures/cookies.d.ts +0 -1
  404. package/dist/targets/node/unirest/fixtures/cookies.js +0 -12
  405. package/dist/targets/node/unirest/fixtures/custom-method.d.ts +0 -1
  406. package/dist/targets/node/unirest/fixtures/custom-method.js +0 -8
  407. package/dist/targets/node/unirest/fixtures/full.d.ts +0 -1
  408. package/dist/targets/node/unirest/fixtures/full.js +0 -27
  409. package/dist/targets/node/unirest/fixtures/headers.d.ts +0 -1
  410. package/dist/targets/node/unirest/fixtures/headers.js +0 -14
  411. package/dist/targets/node/unirest/fixtures/http-insecure.d.ts +0 -1
  412. package/dist/targets/node/unirest/fixtures/http-insecure.js +0 -8
  413. package/dist/targets/node/unirest/fixtures/jsonObj-multiline.d.ts +0 -1
  414. package/dist/targets/node/unirest/fixtures/jsonObj-multiline.js +0 -15
  415. package/dist/targets/node/unirest/fixtures/jsonObj-null-value.d.ts +0 -1
  416. package/dist/targets/node/unirest/fixtures/jsonObj-null-value.js +0 -15
  417. package/dist/targets/node/unirest/fixtures/multipart-data.d.ts +0 -1
  418. package/dist/targets/node/unirest/fixtures/multipart-data.js +0 -20
  419. package/dist/targets/node/unirest/fixtures/multipart-file.d.ts +0 -1
  420. package/dist/targets/node/unirest/fixtures/multipart-file.js +0 -18
  421. package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.d.ts +0 -1
  422. package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.js +0 -11
  423. package/dist/targets/node/unirest/fixtures/multipart-form-data.d.ts +0 -1
  424. package/dist/targets/node/unirest/fixtures/multipart-form-data.js +0 -16
  425. package/dist/targets/node/unirest/fixtures/nested.d.ts +0 -1
  426. package/dist/targets/node/unirest/fixtures/nested.js +0 -13
  427. package/dist/targets/node/unirest/fixtures/postdata-malformed.d.ts +0 -1
  428. package/dist/targets/node/unirest/fixtures/postdata-malformed.js +0 -11
  429. package/dist/targets/node/unirest/fixtures/query-encoded.d.ts +0 -1
  430. package/dist/targets/node/unirest/fixtures/query-encoded.js +0 -12
  431. package/dist/targets/node/unirest/fixtures/query.d.ts +0 -1
  432. package/dist/targets/node/unirest/fixtures/query.js +0 -16
  433. package/dist/targets/node/unirest/fixtures/short.d.ts +0 -1
  434. package/dist/targets/node/unirest/fixtures/short.js +0 -8
  435. package/dist/targets/node/unirest/fixtures/text-plain.d.ts +0 -1
  436. package/dist/targets/node/unirest/fixtures/text-plain.js +0 -12
  437. package/dist/targets/objc/helpers.d.ts +0 -26
  438. package/dist/targets/objc/helpers.js +0 -59
  439. package/dist/targets/objc/nsurlsession/client.d.ts +0 -15
  440. package/dist/targets/objc/nsurlsession/client.js +0 -143
  441. package/dist/targets/objc/target.d.ts +0 -2
  442. package/dist/targets/objc/target.js +0 -15
  443. package/dist/targets/ocaml/cohttp/client.d.ts +0 -11
  444. package/dist/targets/ocaml/cohttp/client.js +0 -64
  445. package/dist/targets/ocaml/target.d.ts +0 -2
  446. package/dist/targets/ocaml/target.js +0 -15
  447. package/dist/targets/php/curl/client.d.ts +0 -19
  448. package/dist/targets/php/curl/client.js +0 -122
  449. package/dist/targets/php/guzzle/client.d.ts +0 -17
  450. package/dist/targets/php/guzzle/client.js +0 -119
  451. package/dist/targets/php/helpers.d.ts +0 -2
  452. package/dist/targets/php/helpers.js +0 -66
  453. package/dist/targets/php/http1/client.d.ts +0 -16
  454. package/dist/targets/php/http1/client.js +0 -76
  455. package/dist/targets/php/http2/client.d.ts +0 -16
  456. package/dist/targets/php/http2/client.js +0 -115
  457. package/dist/targets/php/target.d.ts +0 -2
  458. package/dist/targets/php/target.js +0 -22
  459. package/dist/targets/powershell/common.d.ts +0 -3
  460. package/dist/targets/powershell/common.js +0 -50
  461. package/dist/targets/powershell/restmethod/client.d.ts +0 -2
  462. package/dist/targets/powershell/restmethod/client.js +0 -13
  463. package/dist/targets/powershell/target.d.ts +0 -2
  464. package/dist/targets/powershell/target.js +0 -17
  465. package/dist/targets/powershell/webrequest/client.d.ts +0 -2
  466. package/dist/targets/powershell/webrequest/client.js +0 -13
  467. package/dist/targets/python/helpers.d.ts +0 -8
  468. package/dist/targets/python/helpers.js +0 -64
  469. package/dist/targets/python/requests/client.d.ts +0 -14
  470. package/dist/targets/python/requests/client.js +0 -162
  471. package/dist/targets/python/target.d.ts +0 -2
  472. package/dist/targets/python/target.js +0 -16
  473. package/dist/targets/r/httr/client.d.ts +0 -11
  474. package/dist/targets/r/httr/client.js +0 -130
  475. package/dist/targets/r/target.d.ts +0 -2
  476. package/dist/targets/r/target.js +0 -15
  477. package/dist/targets/ruby/native/client.d.ts +0 -2
  478. package/dist/targets/ruby/native/client.js +0 -67
  479. package/dist/targets/ruby/target.d.ts +0 -2
  480. package/dist/targets/ruby/target.js +0 -15
  481. package/dist/targets/shell/curl/client.d.ts +0 -19
  482. package/dist/targets/shell/curl/client.js +0 -166
  483. package/dist/targets/shell/httpie/client.d.ts +0 -24
  484. package/dist/targets/shell/httpie/client.js +0 -102
  485. package/dist/targets/shell/target.d.ts +0 -2
  486. package/dist/targets/shell/target.js +0 -20
  487. package/dist/targets/shell/wget/client.d.ts +0 -16
  488. package/dist/targets/shell/wget/client.js +0 -46
  489. package/dist/targets/swift/helpers.d.ts +0 -16
  490. package/dist/targets/swift/helpers.js +0 -80
  491. package/dist/targets/swift/nsurlsession/client.d.ts +0 -15
  492. package/dist/targets/swift/nsurlsession/client.js +0 -148
  493. package/dist/targets/swift/target.d.ts +0 -2
  494. package/dist/targets/swift/target.js +0 -15
@@ -1,6 +0,0 @@
1
- import type { ClientInfo, TargetId, TargetInfo } from '../targets/targets';
2
- export interface AvailableTarget extends TargetInfo {
3
- clients: ClientInfo[];
4
- }
5
- export declare const availableTargets: () => AvailableTarget[];
6
- export declare const extname: (targetId: TargetId) => "" | `.${string}`;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.extname = exports.availableTargets = void 0;
15
- var targets_1 = require("../targets/targets");
16
- var availableTargets = function () {
17
- return Object.keys(targets_1.targets).map(function (targetId) { return (__assign(__assign({}, targets_1.targets[targetId].info), { clients: Object.keys(targets_1.targets[targetId].clientsById).map(function (clientId) { return targets_1.targets[targetId].clientsById[clientId].info; }) })); });
18
- };
19
- exports.availableTargets = availableTargets;
20
- var extname = function (targetId) { var _a; return ((_a = targets_1.targets[targetId]) === null || _a === void 0 ? void 0 : _a.info.extname) || ''; };
21
- exports.extname = extname;
@@ -1,2 +0,0 @@
1
- import type { Client } from '../../targets';
2
- export declare const libcurl: Client;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.libcurl = void 0;
4
- var code_builder_1 = require("../../../helpers/code-builder");
5
- var escape_1 = require("../../../helpers/escape");
6
- exports.libcurl = {
7
- info: {
8
- key: 'libcurl',
9
- title: 'Libcurl',
10
- link: 'http://curl.haxx.se/libcurl',
11
- description: 'Simple REST and HTTP API Client for C',
12
- },
13
- convert: function (_a) {
14
- var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
15
- var _b = new code_builder_1.CodeBuilder(), push = _b.push, blank = _b.blank, join = _b.join;
16
- push('CURL *hnd = curl_easy_init();');
17
- blank();
18
- push("curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"".concat(method.toUpperCase(), "\");"));
19
- push('curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);');
20
- push("curl_easy_setopt(hnd, CURLOPT_URL, \"".concat(fullUrl, "\");"));
21
- // Add headers, including the cookies
22
- var headers = Object.keys(headersObj);
23
- // construct headers
24
- if (headers.length) {
25
- blank();
26
- push('struct curl_slist *headers = NULL;');
27
- headers.forEach(function (header) {
28
- push("headers = curl_slist_append(headers, \"".concat(header, ": ").concat((0, escape_1.escapeForDoubleQuotes)(headersObj[header]), "\");"));
29
- });
30
- push('curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);');
31
- }
32
- // construct cookies
33
- if (allHeaders.cookie) {
34
- blank();
35
- push("curl_easy_setopt(hnd, CURLOPT_COOKIE, \"".concat(allHeaders.cookie, "\");"));
36
- }
37
- if (postData.text) {
38
- blank();
39
- push("curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ".concat(JSON.stringify(postData.text), ");"));
40
- }
41
- blank();
42
- push('CURLcode ret = curl_easy_perform(hnd);');
43
- return join();
44
- },
45
- };
@@ -1,2 +0,0 @@
1
- import type { Target } from '../targets';
2
- export declare const c: Target;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.c = void 0;
4
- var client_1 = require("./libcurl/client");
5
- exports.c = {
6
- info: {
7
- key: 'c',
8
- title: 'C',
9
- extname: '.c',
10
- default: 'libcurl',
11
- cli: 'c',
12
- },
13
- clientsById: {
14
- libcurl: client_1.libcurl,
15
- },
16
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * @description
3
- * HTTP code snippet generator for Clojure using clj-http.
4
- *
5
- * @author
6
- * @tggreene
7
- *
8
- * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
9
- */
10
- import type { Client } from '../../targets';
11
- export declare const clj_http: Client;
@@ -1,178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clj_http = void 0;
4
- var code_builder_1 = require("../../../helpers/code-builder");
5
- var headers_1 = require("../../../helpers/headers");
6
- var Keyword = /** @class */ (function () {
7
- function Keyword(name) {
8
- var _this = this;
9
- this.name = '';
10
- this.toString = function () { return ":".concat(_this.name); };
11
- this.name = name;
12
- }
13
- return Keyword;
14
- }());
15
- var File = /** @class */ (function () {
16
- function File(path) {
17
- var _this = this;
18
- this.path = '';
19
- this.toString = function () { return "(clojure.java.io/file \"".concat(_this.path, "\")"); };
20
- this.path = path;
21
- }
22
- return File;
23
- }());
24
- var jsType = function (input) {
25
- if (input === undefined) {
26
- return null;
27
- }
28
- if (input === null) {
29
- return 'null';
30
- }
31
- return input.constructor.name.toLowerCase();
32
- };
33
- var objEmpty = function (input) {
34
- if (input === undefined) {
35
- return true;
36
- }
37
- else if (jsType(input) === 'object') {
38
- return Object.keys(input).length === 0;
39
- }
40
- return false;
41
- };
42
- var filterEmpty = function (input) {
43
- Object.keys(input)
44
- .filter(function (x) { return objEmpty(input[x]); })
45
- .forEach(function (x) {
46
- delete input[x];
47
- });
48
- return input;
49
- };
50
- var padBlock = function (padSize, input) {
51
- var padding = ' '.repeat(padSize);
52
- return input.replace(/\n/g, "\n".concat(padding));
53
- };
54
- var jsToEdn = function (js) {
55
- switch (jsType(js)) {
56
- case 'string':
57
- return "\"".concat(js.replace(/"/g, '\\"'), "\"");
58
- case 'file':
59
- return js.toString();
60
- case 'keyword':
61
- return js.toString();
62
- case 'null':
63
- return 'nil';
64
- case 'regexp':
65
- return "#\"".concat(js.source, "\"");
66
- case 'object': {
67
- // simple vertical format
68
- var obj = Object.keys(js)
69
- .reduce(function (accumulator, key) {
70
- var val = padBlock(key.length + 2, jsToEdn(js[key]));
71
- return "".concat(accumulator, ":").concat(key, " ").concat(val, "\n ");
72
- }, '')
73
- .trim();
74
- return "{".concat(padBlock(1, obj), "}");
75
- }
76
- case 'array': {
77
- // simple horizontal format
78
- var arr = js.reduce(function (accumulator, value) { return "".concat(accumulator, " ").concat(jsToEdn(value)); }, '').trim();
79
- return "[".concat(padBlock(1, arr), "]");
80
- }
81
- default: // 'number' 'boolean'
82
- return js.toString();
83
- }
84
- };
85
- exports.clj_http = {
86
- info: {
87
- key: 'clj_http',
88
- title: 'clj-http',
89
- link: 'https://github.com/dakrone/clj-http',
90
- description: 'An idiomatic clojure http client wrapping the apache client.',
91
- },
92
- convert: function (_a, options) {
93
- var queryObj = _a.queryObj, method = _a.method, postData = _a.postData, url = _a.url, allHeaders = _a.allHeaders;
94
- var _b = new code_builder_1.CodeBuilder({ indent: options === null || options === void 0 ? void 0 : options.indent }), push = _b.push, join = _b.join;
95
- var methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
96
- method = method.toLowerCase();
97
- if (!methods.includes(method)) {
98
- push('Method not supported');
99
- return join();
100
- }
101
- var params = {
102
- headers: allHeaders,
103
- 'query-params': queryObj,
104
- };
105
- switch (postData.mimeType) {
106
- case 'application/json':
107
- {
108
- params['content-type'] = new Keyword('json');
109
- params['form-params'] = postData.jsonObj;
110
- var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
111
- if (header) {
112
- delete params.headers[header];
113
- }
114
- }
115
- break;
116
- case 'application/x-www-form-urlencoded':
117
- {
118
- params['form-params'] = postData.paramsObj;
119
- var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
120
- if (header) {
121
- delete params.headers[header];
122
- }
123
- }
124
- break;
125
- case 'text/plain':
126
- {
127
- params.body = postData.text;
128
- var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
129
- if (header) {
130
- delete params.headers[header];
131
- }
132
- }
133
- break;
134
- case 'multipart/form-data': {
135
- if (postData.params) {
136
- params.multipart = postData.params.map(function (param) {
137
- if (param.fileName && !param.value) {
138
- return {
139
- name: param.name,
140
- content: new File(param.fileName),
141
- };
142
- }
143
- return {
144
- name: param.name,
145
- content: param.value,
146
- };
147
- });
148
- var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
149
- if (header) {
150
- delete params.headers[header];
151
- }
152
- }
153
- break;
154
- }
155
- }
156
- switch ((0, headers_1.getHeader)(params.headers, 'accept')) {
157
- case 'application/json':
158
- {
159
- params.accept = new Keyword('json');
160
- var header = (0, headers_1.getHeaderName)(params.headers, 'accept');
161
- if (header) {
162
- delete params.headers[header];
163
- }
164
- }
165
- break;
166
- }
167
- push("(require '[clj-http.client :as client])\n");
168
- if (objEmpty(filterEmpty(params))) {
169
- push("(client/".concat(method, " \"").concat(url, "\")"));
170
- }
171
- else {
172
- var padding = 11 + method.length + url.length;
173
- var formattedParams = padBlock(padding, jsToEdn(filterEmpty(params)));
174
- push("(client/".concat(method, " \"").concat(url, "\" ").concat(formattedParams, ")"));
175
- }
176
- return join();
177
- },
178
- };
@@ -1,2 +0,0 @@
1
- import type { Target } from '../targets';
2
- export declare const clojure: Target;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clojure = void 0;
4
- var client_1 = require("./clj_http/client");
5
- exports.clojure = {
6
- info: {
7
- key: 'clojure',
8
- title: 'Clojure',
9
- extname: '.clj',
10
- default: 'clj_http',
11
- },
12
- clientsById: {
13
- clj_http: client_1.clj_http,
14
- },
15
- };
@@ -1,2 +0,0 @@
1
- import type { Client } from '../../targets';
2
- export declare const httpclient: Client;
@@ -1,163 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.httpclient = void 0;
15
- var code_builder_1 = require("../../../helpers/code-builder");
16
- var escape_1 = require("../../../helpers/escape");
17
- var headers_1 = require("../../../helpers/headers");
18
- var getDecompressionMethods = function (allHeaders) {
19
- var acceptEncodings = (0, headers_1.getHeader)(allHeaders, 'accept-encoding');
20
- if (!acceptEncodings) {
21
- return []; // no decompression
22
- }
23
- var supportedMethods = {
24
- gzip: 'DecompressionMethods.GZip',
25
- deflate: 'DecompressionMethods.Deflate',
26
- };
27
- var methods = [];
28
- if (typeof acceptEncodings === 'string') {
29
- acceptEncodings = [acceptEncodings];
30
- }
31
- acceptEncodings.forEach(function (acceptEncoding) {
32
- acceptEncoding.split(',').forEach(function (encoding) {
33
- var match = /\s*([^;\s]+)/.exec(encoding);
34
- if (match) {
35
- var method = supportedMethods[match[1]];
36
- if (method) {
37
- methods.push(method);
38
- }
39
- }
40
- });
41
- });
42
- return methods;
43
- };
44
- exports.httpclient = {
45
- info: {
46
- key: 'httpclient',
47
- title: 'HttpClient',
48
- link: 'https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient',
49
- description: '.NET Standard HTTP Client',
50
- },
51
- convert: function (_a, options) {
52
- var _b, _c;
53
- var allHeaders = _a.allHeaders, postData = _a.postData, method = _a.method, fullUrl = _a.fullUrl;
54
- var opts = __assign({ indent: ' ' }, options);
55
- var _d = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _d.push, join = _d.join;
56
- push('using System.Net.Http.Headers;');
57
- var clienthandler = '';
58
- var cookies = Boolean(allHeaders.cookie);
59
- var decompressionMethods = getDecompressionMethods(allHeaders);
60
- if (cookies || decompressionMethods.length) {
61
- clienthandler = 'clientHandler';
62
- push('var clientHandler = new HttpClientHandler');
63
- push('{');
64
- if (cookies) {
65
- // enable setting the cookie header
66
- push('UseCookies = false,', 1);
67
- }
68
- if (decompressionMethods.length) {
69
- // enable decompression for supported methods
70
- push("AutomaticDecompression = ".concat(decompressionMethods.join(' | '), ","), 1);
71
- }
72
- push('};');
73
- }
74
- push("var client = new HttpClient(".concat(clienthandler, ");"));
75
- push('var request = new HttpRequestMessage');
76
- push('{');
77
- var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'TRACE'];
78
- method = method.toUpperCase();
79
- if (method && methods.includes(method)) {
80
- // buildin method
81
- method = "HttpMethod.".concat(method[0]).concat(method.substring(1).toLowerCase());
82
- }
83
- else {
84
- // custom method
85
- method = "new HttpMethod(\"".concat(method, "\")");
86
- }
87
- push("Method = ".concat(method, ","), 1);
88
- push("RequestUri = new Uri(\"".concat(fullUrl, "\"),"), 1);
89
- var headers = Object.keys(allHeaders).filter(function (header) {
90
- switch (header.toLowerCase()) {
91
- case 'content-type':
92
- case 'content-length':
93
- case 'accept-encoding':
94
- // skip these headers
95
- return false;
96
- default:
97
- return true;
98
- }
99
- });
100
- if (headers.length) {
101
- push('Headers =', 1);
102
- push('{', 1);
103
- headers.forEach(function (key) {
104
- push("{ \"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\" },"), 2);
105
- });
106
- push('},', 1);
107
- }
108
- if (postData.text) {
109
- var contentType = postData.mimeType;
110
- switch (contentType) {
111
- case 'application/x-www-form-urlencoded':
112
- push('Content = new FormUrlEncodedContent(new Dictionary<string, string>', 1);
113
- push('{', 1);
114
- (_b = postData.params) === null || _b === void 0 ? void 0 : _b.forEach(function (param) {
115
- push("{ \"".concat(param.name, "\", \"").concat(param.value, "\" },"), 2);
116
- });
117
- push('}),', 1);
118
- break;
119
- case 'multipart/form-data':
120
- push('Content = new MultipartFormDataContent', 1);
121
- push('{', 1);
122
- (_c = postData.params) === null || _c === void 0 ? void 0 : _c.forEach(function (param) {
123
- push("new StringContent(".concat(JSON.stringify(param.value || ''), ")"), 2);
124
- push('{', 2);
125
- push('Headers =', 3);
126
- push('{', 3);
127
- if (param.contentType) {
128
- push("ContentType = new MediaTypeHeaderValue(\"".concat(param.contentType, "\"),"), 4);
129
- }
130
- push('ContentDisposition = new ContentDispositionHeaderValue("form-data")', 4);
131
- push('{', 4);
132
- push("Name = \"".concat(param.name, "\","), 5);
133
- if (param.fileName) {
134
- push("FileName = \"".concat(param.fileName, "\","), 5);
135
- }
136
- push('}', 4);
137
- push('}', 3);
138
- push('},', 2);
139
- });
140
- push('},', 1);
141
- break;
142
- default:
143
- push("Content = new StringContent(".concat(JSON.stringify(postData.text || ''), ")"), 1);
144
- push('{', 1);
145
- push('Headers =', 2);
146
- push('{', 2);
147
- push("ContentType = new MediaTypeHeaderValue(\"".concat(contentType, "\")"), 3);
148
- push('}', 2);
149
- push('}', 1);
150
- break;
151
- }
152
- }
153
- push('};');
154
- // send and read response
155
- push('using (var response = await client.SendAsync(request))');
156
- push('{');
157
- push('response.EnsureSuccessStatusCode();', 1);
158
- push('var body = await response.Content.ReadAsStringAsync();', 1);
159
- push('Console.WriteLine(body);', 1);
160
- push('}');
161
- return join();
162
- },
163
- };
@@ -1,2 +0,0 @@
1
- import type { Client } from '../../targets';
2
- export declare const restsharp: Client;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.restsharp = void 0;
4
- var code_builder_1 = require("../../../helpers/code-builder");
5
- var escape_1 = require("../../../helpers/escape");
6
- function title(s) {
7
- return s[0].toUpperCase() + s.slice(1).toLowerCase();
8
- }
9
- exports.restsharp = {
10
- info: {
11
- key: 'restsharp',
12
- title: 'RestSharp',
13
- link: 'http://restsharp.org/',
14
- description: 'Simple REST and HTTP API Client for .NET',
15
- },
16
- convert: function (_a) {
17
- var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, cookies = _a.cookies, postData = _a.postData, uriObj = _a.uriObj;
18
- var _b = new code_builder_1.CodeBuilder(), push = _b.push, join = _b.join;
19
- var isSupportedMethod = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'].includes(method.toUpperCase());
20
- if (!isSupportedMethod) {
21
- return 'Method not supported';
22
- }
23
- push('using RestSharp;\n\n');
24
- push("var options = new RestClientOptions(\"".concat(fullUrl, "\");"));
25
- push('var client = new RestClient(options);');
26
- // The first argument is the sub-path to the base URL, given as the
27
- // constructor to RestClient; for our purposes we're just giving the entire
28
- // URL as the base path so it can be an empty string
29
- push('var request = new RestRequest("");');
30
- // If we have multipart form data, set this value. Setting the content-type header manually and then trying to add a mutlipart file parameter
31
- var isMultipart = postData.mimeType && postData.mimeType === 'multipart/form-data';
32
- if (isMultipart) {
33
- push('request.AlwaysMultipartFormData = true;');
34
- }
35
- // Add headers, including the cookies
36
- Object.keys(headersObj).forEach(function (key) {
37
- // if we have post data, restsharp really wants to set the contentType
38
- // itself; do not add a content-type header or you end up with failures
39
- // which manifest as unhandled exceptions.
40
- //
41
- // The only case where we _do_ want to add it is if there's no postData
42
- // text, in which case there will be no `AddJsonBody` call, and restsharp
43
- // won't know to set the content type
44
- if (postData.mimeType && key.toLowerCase() === 'content-type' && postData.text) {
45
- if (isMultipart && postData.boundary) {
46
- push("request.FormBoundary = \"".concat(postData.boundary, "\";"));
47
- }
48
- return;
49
- }
50
- push("request.AddHeader(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(headersObj[key]), "\");"));
51
- });
52
- cookies.forEach(function (_a) {
53
- var name = _a.name, value = _a.value;
54
- push("request.AddCookie(\"".concat(name, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(value), "\", \"").concat(uriObj.pathname, "\", \"").concat(uriObj.host, "\");"));
55
- });
56
- switch (postData.mimeType) {
57
- case 'multipart/form-data':
58
- if (!postData.params)
59
- break;
60
- postData.params.forEach(function (param) {
61
- if (param.fileName) {
62
- push("request.AddFile(\"".concat(param.name, "\", \"").concat(param.fileName, "\");"));
63
- }
64
- else {
65
- push("request.AddParameter(\"".concat(param.name, "\", \"").concat(param.value, "\");"));
66
- }
67
- });
68
- break;
69
- case 'application/x-www-form-urlencoded':
70
- if (!postData.params)
71
- break;
72
- postData.params.forEach(function (param) {
73
- push("request.AddParameter(\"".concat(param.name, "\", \"").concat(param.value, "\");"));
74
- });
75
- break;
76
- case 'application/json': {
77
- if (!postData.text)
78
- break;
79
- var text = JSON.stringify(postData.text);
80
- push("request.AddJsonBody(".concat(text, ", false);"));
81
- break;
82
- }
83
- default:
84
- if (!postData.text)
85
- break;
86
- push("request.AddStringBody(\"".concat(postData.text, "\", \"").concat(postData.mimeType, "\");"));
87
- }
88
- push("var response = await client.".concat(title(method), "Async(request);\n"));
89
- push('Console.WriteLine("{0}", response.Content);\n');
90
- return join();
91
- },
92
- };
@@ -1,2 +0,0 @@
1
- import type { Target } from '../targets';
2
- export declare const csharp: Target;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.csharp = void 0;
4
- var client_1 = require("./httpclient/client");
5
- var client_2 = require("./restsharp/client");
6
- exports.csharp = {
7
- info: {
8
- key: 'csharp',
9
- title: 'C#',
10
- extname: '.cs',
11
- default: 'restsharp',
12
- cli: 'dotnet',
13
- },
14
- clientsById: {
15
- httpclient: client_1.httpclient,
16
- restsharp: client_2.restsharp,
17
- },
18
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * @description
3
- * HTTP code snippet generator for native Go.
4
- *
5
- * @author
6
- * @montanaflynn
7
- *
8
- * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
9
- */
10
- import type { Client } from '../../targets';
11
- export interface GoNativeOptions {
12
- checkErrors?: boolean;
13
- printBody?: boolean;
14
- showBoilerplate?: boolean;
15
- timeout?: number;
16
- }
17
- export declare const native: Client<GoNativeOptions>;