@readme/httpsnippet 3.1.3 → 4.0.2

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 (319) hide show
  1. package/README.md +63 -62
  2. package/dist/package.json +86 -0
  3. package/dist/src/fixtures/customTarget.js +15 -0
  4. package/dist/src/fixtures/mimetypes.js +77 -0
  5. package/dist/src/fixtures/requests/application-form-encoded.js +69 -0
  6. package/dist/src/fixtures/requests/application-json.js +72 -0
  7. package/dist/src/fixtures/requests/cookies.js +51 -0
  8. package/dist/src/fixtures/requests/custom-method.js +41 -0
  9. package/dist/src/fixtures/requests/full.js +99 -0
  10. package/dist/src/fixtures/requests/headers.js +56 -0
  11. package/dist/src/fixtures/requests/http-insecure.js +45 -0
  12. package/dist/src/fixtures/requests/jsonObj-multiline.js +59 -0
  13. package/dist/src/fixtures/requests/jsonObj-null-value.js +61 -0
  14. package/dist/src/fixtures/requests/multipart-data.js +72 -0
  15. package/dist/src/fixtures/requests/multipart-file.js +65 -0
  16. package/dist/src/fixtures/requests/multipart-form-data-no-params.js +56 -0
  17. package/dist/src/fixtures/requests/multipart-form-data.js +64 -0
  18. package/dist/src/fixtures/requests/nested.js +64 -0
  19. package/dist/src/fixtures/requests/query-encoded.js +59 -0
  20. package/dist/src/fixtures/requests/query.js +64 -0
  21. package/dist/src/fixtures/requests/short.js +45 -0
  22. package/dist/src/fixtures/requests/text-plain.js +57 -0
  23. package/dist/src/fixtures/runCustomFixtures.js +77 -0
  24. package/dist/src/helpers/code-builder.js +91 -0
  25. package/dist/src/helpers/form-data.js +157 -0
  26. package/dist/src/helpers/har-validator.js +76 -0
  27. package/dist/src/helpers/headers.js +33 -0
  28. package/dist/src/helpers/reducer.js +19 -0
  29. package/dist/src/helpers/shell.js +20 -0
  30. package/dist/src/helpers/utils.js +21 -0
  31. package/dist/src/index.js +285 -0
  32. package/dist/src/targets/c/libcurl/client.js +43 -0
  33. package/dist/src/targets/c/target.js +15 -0
  34. package/dist/src/targets/clojure/clj_http/client.js +184 -0
  35. package/dist/src/targets/clojure/target.js +15 -0
  36. package/dist/src/targets/csharp/httpclient/client.js +162 -0
  37. package/dist/src/targets/csharp/restsharp/client.js +38 -0
  38. package/dist/src/targets/csharp/target.js +17 -0
  39. package/dist/src/targets/go/native/client.js +122 -0
  40. package/dist/src/targets/go/target.js +15 -0
  41. package/dist/src/targets/http/http1.1/client.js +79 -0
  42. package/dist/src/targets/http/target.js +15 -0
  43. package/dist/src/targets/java/asynchttp/client.js +53 -0
  44. package/dist/src/targets/java/nethttp/client.js +52 -0
  45. package/dist/src/targets/java/okhttp/client.js +79 -0
  46. package/dist/src/targets/java/target.js +21 -0
  47. package/dist/src/targets/java/unirest/client.js +53 -0
  48. package/dist/src/targets/javascript/axios/client.js +101 -0
  49. package/dist/src/targets/javascript/axios/fixtures/application-form-encoded.js +22 -0
  50. package/dist/src/targets/javascript/axios/fixtures/application-json.js +26 -0
  51. package/dist/src/targets/javascript/axios/fixtures/cookies.js +18 -0
  52. package/dist/src/targets/javascript/axios/fixtures/custom-method.js +14 -0
  53. package/dist/src/targets/javascript/axios/fixtures/full.js +26 -0
  54. package/dist/src/targets/javascript/axios/fixtures/headers.js +18 -0
  55. package/dist/src/targets/javascript/axios/fixtures/http-insecure.js +14 -0
  56. package/dist/src/targets/javascript/axios/fixtures/jsonObj-multiline.js +19 -0
  57. package/dist/src/targets/javascript/axios/fixtures/jsonObj-null-value.js +19 -0
  58. package/dist/src/targets/javascript/axios/fixtures/multipart-data.js +22 -0
  59. package/dist/src/targets/javascript/axios/fixtures/multipart-file.js +21 -0
  60. package/dist/src/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +18 -0
  61. package/dist/src/targets/javascript/axios/fixtures/multipart-form-data.js +21 -0
  62. package/dist/src/targets/javascript/axios/fixtures/nested.js +18 -0
  63. package/dist/src/targets/javascript/axios/fixtures/query-encoded.js +21 -0
  64. package/dist/src/targets/javascript/axios/fixtures/query.js +18 -0
  65. package/dist/src/targets/javascript/axios/fixtures/short.js +14 -0
  66. package/dist/src/targets/javascript/axios/fixtures/text-plain.js +19 -0
  67. package/dist/src/targets/javascript/fetch/client.js +115 -0
  68. package/dist/src/targets/javascript/fetch/fixtures/application-form-encoded.js +9 -0
  69. package/dist/src/targets/javascript/fetch/fixtures/application-json.js +16 -0
  70. package/dist/src/targets/javascript/fetch/fixtures/cookies.js +5 -0
  71. package/dist/src/targets/javascript/fetch/fixtures/custom-method.js +5 -0
  72. package/dist/src/targets/javascript/fetch/fixtures/full.js +13 -0
  73. package/dist/src/targets/javascript/fetch/fixtures/headers.js +8 -0
  74. package/dist/src/targets/javascript/fetch/fixtures/http-insecure.js +5 -0
  75. package/dist/src/targets/javascript/fetch/fixtures/jsonObj-multiline.js +9 -0
  76. package/dist/src/targets/javascript/fetch/fixtures/jsonObj-null-value.js +9 -0
  77. package/dist/src/targets/javascript/fetch/fixtures/multipart-data.js +9 -0
  78. package/dist/src/targets/javascript/fetch/fixtures/multipart-file.js +8 -0
  79. package/dist/src/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +5 -0
  80. package/dist/src/targets/javascript/fetch/fixtures/multipart-form-data.js +8 -0
  81. package/dist/src/targets/javascript/fetch/fixtures/nested.js +5 -0
  82. package/dist/src/targets/javascript/fetch/fixtures/query-encoded.js +5 -0
  83. package/dist/src/targets/javascript/fetch/fixtures/query.js +5 -0
  84. package/dist/src/targets/javascript/fetch/fixtures/short.js +5 -0
  85. package/dist/src/targets/javascript/fetch/fixtures/text-plain.js +5 -0
  86. package/dist/src/targets/javascript/jquery/client.js +93 -0
  87. package/dist/src/targets/javascript/jquery/fixtures/application-form-encoded.js +17 -0
  88. package/dist/src/targets/javascript/jquery/fixtures/application-json.js +15 -0
  89. package/dist/src/targets/javascript/jquery/fixtures/cookies.js +13 -0
  90. package/dist/src/targets/javascript/jquery/fixtures/custom-method.js +11 -0
  91. package/dist/src/targets/javascript/jquery/fixtures/full.js +18 -0
  92. package/dist/src/targets/javascript/jquery/fixtures/headers.js +15 -0
  93. package/dist/src/targets/javascript/jquery/fixtures/http-insecure.js +11 -0
  94. package/dist/src/targets/javascript/jquery/fixtures/jsonObj-multiline.js +15 -0
  95. package/dist/src/targets/javascript/jquery/fixtures/jsonObj-null-value.js +15 -0
  96. package/dist/src/targets/javascript/jquery/fixtures/multipart-data.js +18 -0
  97. package/dist/src/targets/javascript/jquery/fixtures/multipart-file.js +17 -0
  98. package/dist/src/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +13 -0
  99. package/dist/src/targets/javascript/jquery/fixtures/multipart-form-data.js +17 -0
  100. package/dist/src/targets/javascript/jquery/fixtures/nested.js +11 -0
  101. package/dist/src/targets/javascript/jquery/fixtures/query-encoded.js +11 -0
  102. package/dist/src/targets/javascript/jquery/fixtures/query.js +11 -0
  103. package/dist/src/targets/javascript/jquery/fixtures/short.js +11 -0
  104. package/dist/src/targets/javascript/jquery/fixtures/text-plain.js +14 -0
  105. package/dist/src/targets/javascript/target.js +21 -0
  106. package/dist/src/targets/javascript/xhr/client.js +90 -0
  107. package/dist/src/targets/javascript/xhr/fixtures/application-form-encoded.js +12 -0
  108. package/dist/src/targets/javascript/xhr/fixtures/application-json.js +31 -0
  109. package/dist/src/targets/javascript/xhr/fixtures/cookies.js +12 -0
  110. package/dist/src/targets/javascript/xhr/fixtures/cors.js +10 -0
  111. package/dist/src/targets/javascript/xhr/fixtures/custom-method.js +11 -0
  112. package/dist/src/targets/javascript/xhr/fixtures/full.js +14 -0
  113. package/dist/src/targets/javascript/xhr/fixtures/headers.js +14 -0
  114. package/dist/src/targets/javascript/xhr/fixtures/http-insecure.js +11 -0
  115. package/dist/src/targets/javascript/xhr/fixtures/jsonObj-multiline.js +14 -0
  116. package/dist/src/targets/javascript/xhr/fixtures/jsonObj-null-value.js +14 -0
  117. package/dist/src/targets/javascript/xhr/fixtures/multipart-data.js +13 -0
  118. package/dist/src/targets/javascript/xhr/fixtures/multipart-file.js +12 -0
  119. package/dist/src/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +11 -0
  120. package/dist/src/targets/javascript/xhr/fixtures/multipart-form-data.js +12 -0
  121. package/dist/src/targets/javascript/xhr/fixtures/nested.js +11 -0
  122. package/dist/src/targets/javascript/xhr/fixtures/query-encoded.js +11 -0
  123. package/dist/src/targets/javascript/xhr/fixtures/query.js +11 -0
  124. package/dist/src/targets/javascript/xhr/fixtures/short.js +11 -0
  125. package/dist/src/targets/javascript/xhr/fixtures/text-plain.js +12 -0
  126. package/dist/src/targets/kotlin/okhttp/client.js +79 -0
  127. package/dist/src/targets/kotlin/target.js +15 -0
  128. package/dist/src/targets/node/axios/client.js +87 -0
  129. package/dist/src/targets/node/axios/fixtures/application-form-encoded.js +19 -0
  130. package/dist/src/targets/node/axios/fixtures/application-json.js +22 -0
  131. package/dist/src/targets/node/axios/fixtures/cookies.js +14 -0
  132. package/dist/src/targets/node/axios/fixtures/custom-method.js +10 -0
  133. package/dist/src/targets/node/axios/fixtures/full.js +22 -0
  134. package/dist/src/targets/node/axios/fixtures/headers.js +14 -0
  135. package/dist/src/targets/node/axios/fixtures/http-insecure.js +10 -0
  136. package/dist/src/targets/node/axios/fixtures/jsonObj-multiline.js +15 -0
  137. package/dist/src/targets/node/axios/fixtures/jsonObj-null-value.js +15 -0
  138. package/dist/src/targets/node/axios/fixtures/multipart-data.js +15 -0
  139. package/dist/src/targets/node/axios/fixtures/multipart-file.js +15 -0
  140. package/dist/src/targets/node/axios/fixtures/multipart-form-data-no-params.js +14 -0
  141. package/dist/src/targets/node/axios/fixtures/multipart-form-data.js +15 -0
  142. package/dist/src/targets/node/axios/fixtures/nested.js +13 -0
  143. package/dist/src/targets/node/axios/fixtures/query-encoded.js +13 -0
  144. package/dist/src/targets/node/axios/fixtures/query.js +13 -0
  145. package/dist/src/targets/node/axios/fixtures/short.js +10 -0
  146. package/dist/src/targets/node/axios/fixtures/text-plain.js +15 -0
  147. package/dist/src/targets/node/fetch/client.js +149 -0
  148. package/dist/src/targets/node/fetch/fixtures/application-form-encoded.js +15 -0
  149. package/dist/src/targets/node/fetch/fixtures/application-json.js +18 -0
  150. package/dist/src/targets/node/fetch/fixtures/cookies.js +7 -0
  151. package/dist/src/targets/node/fetch/fixtures/custom-method.js +7 -0
  152. package/dist/src/targets/node/fetch/fixtures/full.js +18 -0
  153. package/dist/src/targets/node/fetch/fixtures/headers.js +10 -0
  154. package/dist/src/targets/node/fetch/fixtures/http-insecure.js +7 -0
  155. package/dist/src/targets/node/fetch/fixtures/jsonObj-multiline.js +11 -0
  156. package/dist/src/targets/node/fetch/fixtures/jsonObj-null-value.js +11 -0
  157. package/dist/src/targets/node/fetch/fixtures/multipart-data.js +13 -0
  158. package/dist/src/targets/node/fetch/fixtures/multipart-file.js +12 -0
  159. package/dist/src/targets/node/fetch/fixtures/multipart-form-data-no-params.js +7 -0
  160. package/dist/src/targets/node/fetch/fixtures/multipart-form-data.js +11 -0
  161. package/dist/src/targets/node/fetch/fixtures/nested.js +7 -0
  162. package/dist/src/targets/node/fetch/fixtures/query-encoded.js +7 -0
  163. package/dist/src/targets/node/fetch/fixtures/query.js +7 -0
  164. package/dist/src/targets/node/fetch/fixtures/short.js +7 -0
  165. package/dist/src/targets/node/fetch/fixtures/text-plain.js +7 -0
  166. package/dist/src/targets/node/native/client.js +91 -0
  167. package/dist/src/targets/node/native/fixtures/application-form-encoded.js +24 -0
  168. package/dist/src/targets/node/native/fixtures/application-json.js +30 -0
  169. package/dist/src/targets/node/native/fixtures/cookies.js +22 -0
  170. package/dist/src/targets/node/native/fixtures/custom-method.js +20 -0
  171. package/dist/src/targets/node/native/fixtures/full.js +26 -0
  172. package/dist/src/targets/node/native/fixtures/headers.js +24 -0
  173. package/dist/src/targets/node/native/fixtures/http-insecure.js +20 -0
  174. package/dist/src/targets/node/native/fixtures/jsonObj-multiline.js +23 -0
  175. package/dist/src/targets/node/native/fixtures/jsonObj-null-value.js +23 -0
  176. package/dist/src/targets/node/native/fixtures/multipart-data.js +23 -0
  177. package/dist/src/targets/node/native/fixtures/multipart-file.js +23 -0
  178. package/dist/src/targets/node/native/fixtures/multipart-form-data-no-params.js +22 -0
  179. package/dist/src/targets/node/native/fixtures/multipart-form-data.js +23 -0
  180. package/dist/src/targets/node/native/fixtures/nested.js +20 -0
  181. package/dist/src/targets/node/native/fixtures/query-encoded.js +20 -0
  182. package/dist/src/targets/node/native/fixtures/query.js +20 -0
  183. package/dist/src/targets/node/native/fixtures/short.js +20 -0
  184. package/dist/src/targets/node/native/fixtures/text-plain.js +23 -0
  185. package/dist/src/targets/node/request/client.js +116 -0
  186. package/dist/src/targets/node/request/fixtures/application-form-encoded.js +13 -0
  187. package/dist/src/targets/node/request/fixtures/application-json.js +21 -0
  188. package/dist/src/targets/node/request/fixtures/cookies.js +11 -0
  189. package/dist/src/targets/node/request/fixtures/custom-method.js +8 -0
  190. package/dist/src/targets/node/request/fixtures/full.js +20 -0
  191. package/dist/src/targets/node/request/fixtures/headers.js +12 -0
  192. package/dist/src/targets/node/request/fixtures/http-insecure.js +8 -0
  193. package/dist/src/targets/node/request/fixtures/jsonObj-multiline.js +14 -0
  194. package/dist/src/targets/node/request/fixtures/jsonObj-null-value.js +14 -0
  195. package/dist/src/targets/node/request/fixtures/multipart-data.js +20 -0
  196. package/dist/src/targets/node/request/fixtures/multipart-file.js +19 -0
  197. package/dist/src/targets/node/request/fixtures/multipart-form-data-no-params.js +12 -0
  198. package/dist/src/targets/node/request/fixtures/multipart-form-data.js +13 -0
  199. package/dist/src/targets/node/request/fixtures/nested.js +11 -0
  200. package/dist/src/targets/node/request/fixtures/query-encoded.js +11 -0
  201. package/dist/src/targets/node/request/fixtures/query.js +11 -0
  202. package/dist/src/targets/node/request/fixtures/short.js +8 -0
  203. package/dist/src/targets/node/request/fixtures/text-plain.js +13 -0
  204. package/dist/src/targets/node/target.js +24 -0
  205. package/dist/src/targets/node/unirest/client.js +119 -0
  206. package/dist/src/targets/node/unirest/fixtures/application-form-encoded.js +15 -0
  207. package/dist/src/targets/node/unirest/fixtures/application-json.js +32 -0
  208. package/dist/src/targets/node/unirest/fixtures/cookies.js +12 -0
  209. package/dist/src/targets/node/unirest/fixtures/custom-method.js +8 -0
  210. package/dist/src/targets/node/unirest/fixtures/full.js +27 -0
  211. package/dist/src/targets/node/unirest/fixtures/headers.js +13 -0
  212. package/dist/src/targets/node/unirest/fixtures/http-insecure.js +8 -0
  213. package/dist/src/targets/node/unirest/fixtures/jsonObj-multiline.js +15 -0
  214. package/dist/src/targets/node/unirest/fixtures/jsonObj-null-value.js +15 -0
  215. package/dist/src/targets/node/unirest/fixtures/multipart-data.js +20 -0
  216. package/dist/src/targets/node/unirest/fixtures/multipart-file.js +18 -0
  217. package/dist/src/targets/node/unirest/fixtures/multipart-form-data-no-params.js +11 -0
  218. package/dist/src/targets/node/unirest/fixtures/multipart-form-data.js +16 -0
  219. package/dist/src/targets/node/unirest/fixtures/nested.js +13 -0
  220. package/dist/src/targets/node/unirest/fixtures/query-encoded.js +12 -0
  221. package/dist/src/targets/node/unirest/fixtures/query.js +16 -0
  222. package/dist/src/targets/node/unirest/fixtures/short.js +8 -0
  223. package/dist/src/targets/node/unirest/fixtures/text-plain.js +12 -0
  224. package/dist/src/targets/objc/helpers.js +59 -0
  225. package/dist/src/targets/objc/nsurlsession/client.js +151 -0
  226. package/dist/src/targets/objc/target.js +15 -0
  227. package/dist/src/targets/ocaml/cohttp/client.js +72 -0
  228. package/dist/src/targets/ocaml/target.js +15 -0
  229. package/dist/src/targets/php/curl/client.js +135 -0
  230. package/dist/src/targets/php/guzzle/client.js +126 -0
  231. package/dist/src/targets/php/helpers.js +63 -0
  232. package/dist/src/targets/php/http1/client.js +90 -0
  233. package/dist/src/targets/php/http2/client.js +128 -0
  234. package/dist/src/targets/php/target.js +22 -0
  235. package/dist/src/targets/powershell/common.js +49 -0
  236. package/dist/src/targets/powershell/restmethod/client.js +13 -0
  237. package/dist/src/targets/powershell/target.js +17 -0
  238. package/dist/src/targets/powershell/webrequest/client.js +13 -0
  239. package/dist/src/targets/python/helpers.js +70 -0
  240. package/dist/src/targets/python/requests/client.js +161 -0
  241. package/dist/src/targets/python/target.js +16 -0
  242. package/dist/src/targets/r/httr/client.js +125 -0
  243. package/dist/src/targets/r/target.js +15 -0
  244. package/dist/src/targets/ruby/native/client.js +69 -0
  245. package/dist/src/targets/ruby/target.js +15 -0
  246. package/dist/src/targets/shell/curl/client.js +171 -0
  247. package/dist/src/targets/shell/httpie/client.js +111 -0
  248. package/dist/src/targets/shell/target.js +20 -0
  249. package/dist/src/targets/shell/wget/client.js +55 -0
  250. package/dist/src/targets/swift/helpers.js +80 -0
  251. package/dist/src/targets/swift/nsurlsession/client.js +156 -0
  252. package/dist/src/targets/swift/target.js +15 -0
  253. package/dist/src/targets/targets.js +130 -0
  254. package/package.json +26 -21
  255. package/src/helpers/code-builder.js +0 -108
  256. package/src/helpers/form-data.js +0 -107
  257. package/src/helpers/headers.js +0 -48
  258. package/src/helpers/reducer.js +0 -20
  259. package/src/index.js +0 -361
  260. package/src/targets/c/index.js +0 -10
  261. package/src/targets/c/libcurl.js +0 -45
  262. package/src/targets/clojure/clj_http.js +0 -176
  263. package/src/targets/clojure/index.js +0 -10
  264. package/src/targets/csharp/httpclient.js +0 -157
  265. package/src/targets/csharp/index.js +0 -11
  266. package/src/targets/csharp/restsharp.js +0 -49
  267. package/src/targets/go/index.js +0 -10
  268. package/src/targets/go/native.js +0 -130
  269. package/src/targets/http/http1.1.js +0 -89
  270. package/src/targets/http/index.js +0 -10
  271. package/src/targets/index.js +0 -20
  272. package/src/targets/java/asynchttp.js +0 -54
  273. package/src/targets/java/index.js +0 -13
  274. package/src/targets/java/nethttp.js +0 -59
  275. package/src/targets/java/okhttp.js +0 -78
  276. package/src/targets/java/unirest.js +0 -57
  277. package/src/targets/javascript/axios.js +0 -101
  278. package/src/targets/javascript/fetch.js +0 -129
  279. package/src/targets/javascript/index.js +0 -13
  280. package/src/targets/javascript/jquery.js +0 -89
  281. package/src/targets/javascript/xhr.js +0 -86
  282. package/src/targets/kotlin/index.js +0 -10
  283. package/src/targets/kotlin/okhttp.js +0 -78
  284. package/src/targets/node/axios.js +0 -76
  285. package/src/targets/node/fetch.js +0 -145
  286. package/src/targets/node/index.js +0 -15
  287. package/src/targets/node/native.js +0 -92
  288. package/src/targets/node/request.js +0 -126
  289. package/src/targets/node/unirest.js +0 -120
  290. package/src/targets/objc/helpers.js +0 -80
  291. package/src/targets/objc/index.js +0 -10
  292. package/src/targets/objc/nsurlsession.js +0 -164
  293. package/src/targets/ocaml/cohttp.js +0 -73
  294. package/src/targets/ocaml/index.js +0 -10
  295. package/src/targets/php/curl.js +0 -142
  296. package/src/targets/php/guzzle.js +0 -135
  297. package/src/targets/php/helpers.js +0 -87
  298. package/src/targets/php/http1.js +0 -85
  299. package/src/targets/php/http2.js +0 -131
  300. package/src/targets/php/index.js +0 -14
  301. package/src/targets/powershell/common.js +0 -60
  302. package/src/targets/powershell/index.js +0 -11
  303. package/src/targets/powershell/restmethod.js +0 -8
  304. package/src/targets/powershell/webrequest.js +0 -8
  305. package/src/targets/python/helpers.js +0 -85
  306. package/src/targets/python/index.js +0 -11
  307. package/src/targets/python/requests.js +0 -163
  308. package/src/targets/r/httr.js +0 -134
  309. package/src/targets/r/index.js +0 -10
  310. package/src/targets/ruby/index.js +0 -10
  311. package/src/targets/ruby/native.js +0 -71
  312. package/src/targets/shell/curl.js +0 -157
  313. package/src/targets/shell/helpers.js +0 -23
  314. package/src/targets/shell/httpie.js +0 -129
  315. package/src/targets/shell/index.js +0 -13
  316. package/src/targets/shell/wget.js +0 -52
  317. package/src/targets/swift/helpers.js +0 -93
  318. package/src/targets/swift/index.js +0 -10
  319. package/src/targets/swift/nsurlsession.js +0 -152
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.reducer = void 0;
4
+ var reducer = function (accumulator, pair) {
5
+ var currentValue = accumulator[pair.name];
6
+ if (currentValue === undefined) {
7
+ accumulator[pair.name] = pair.value;
8
+ return accumulator;
9
+ }
10
+ // If we already have it as array just push the value
11
+ if (Array.isArray(currentValue)) {
12
+ currentValue.push(pair.value);
13
+ return accumulator;
14
+ }
15
+ // convert to array since now we have more than one value for this key
16
+ accumulator[pair.name] = [currentValue, pair.value];
17
+ return accumulator;
18
+ };
19
+ exports.reducer = reducer;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.escape = exports.quote = void 0;
4
+ /**
5
+ * Use 'strong quoting' using single quotes so that we only need to deal with nested single quote characters.
6
+ * see: http://wiki.bash-hackers.org/syntax/quoting#strong_quoting
7
+ */
8
+ var quote = function (value) {
9
+ if (value === void 0) { value = ''; }
10
+ var safe = /^[a-z0-9-_/.@%^=:]+$/i;
11
+ var isShellSafe = safe.test(value);
12
+ if (isShellSafe) {
13
+ return value;
14
+ }
15
+ // if the value is not shell safe, then quote it
16
+ return "'".concat(value.replace(/'/g, "'\\''"), "'");
17
+ };
18
+ exports.quote = quote;
19
+ var escape = function (value) { return value.replace(/\r/g, '\\r').replace(/\n/g, '\\n'); };
20
+ exports.escape = escape;
@@ -0,0 +1,21 @@
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
+ exports.__esModule = 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;
@@ -0,0 +1,285 @@
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
+ 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
+ var __values = (this && this.__values) || function(o) {
25
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
26
+ if (m) return m.call(o);
27
+ if (o && typeof o.length === "number") return {
28
+ next: function () {
29
+ if (o && i >= o.length) o = void 0;
30
+ return { value: o && o[i++], done: !o };
31
+ }
32
+ };
33
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
34
+ };
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ exports.__esModule = true;
39
+ exports.HTTPSnippet = exports.addTargetClient = exports.addTarget = exports.extname = exports.availableTargets = void 0;
40
+ var event_stream_1 = require("event-stream");
41
+ var form_data_1 = __importDefault(require("form-data"));
42
+ var qs_1 = require("qs");
43
+ // eslint-disable-next-line node/no-deprecated-api
44
+ var url_1 = require("url");
45
+ var form_data_2 = require("./helpers/form-data");
46
+ var har_validator_1 = require("./helpers/har-validator");
47
+ var headers_1 = require("./helpers/headers");
48
+ var reducer_1 = require("./helpers/reducer");
49
+ var targets_1 = require("./targets/targets");
50
+ var utils_1 = require("./helpers/utils");
51
+ __createBinding(exports, utils_1, "availableTargets");
52
+ __createBinding(exports, utils_1, "extname");
53
+ var targets_2 = require("./targets/targets");
54
+ __createBinding(exports, targets_2, "addTarget");
55
+ __createBinding(exports, targets_2, "addTargetClient");
56
+ var DEBUG_MODE = false;
57
+ var debug = {
58
+ // eslint-disable-next-line @typescript-eslint/no-empty-function -- intentional noop
59
+ info: DEBUG_MODE ? console.info : function () { }
60
+ };
61
+ var isHarEntry = function (value) {
62
+ return typeof value === 'object' &&
63
+ 'log' in value &&
64
+ typeof value.log === 'object' &&
65
+ 'entries' in value.log &&
66
+ Array.isArray(value.log.entries);
67
+ };
68
+ var HTTPSnippet = /** @class */ (function () {
69
+ function HTTPSnippet(input, opts) {
70
+ if (opts === void 0) { opts = {}; }
71
+ var _this = this;
72
+ this.requests = [];
73
+ this.prepare = function (harRequest, options) {
74
+ var e_1, _a;
75
+ var _b, _c, _d;
76
+ var request = __assign(__assign({}, harRequest), { fullUrl: '', uriObj: {}, queryObj: {}, headersObj: {}, cookiesObj: {}, allHeaders: {} });
77
+ // construct query objects
78
+ if (request.queryString && request.queryString.length) {
79
+ debug.info('queryString found, constructing queryString pair map');
80
+ request.queryObj = request.queryString.reduce(reducer_1.reducer, {});
81
+ }
82
+ // construct headers objects
83
+ if (request.headers && request.headers.length) {
84
+ var http2VersionRegex_1 = /^HTTP\/2/;
85
+ request.headersObj = request.headers.reduce(function (accumulator, _a) {
86
+ var _b;
87
+ var name = _a.name, value = _a.value;
88
+ var headerName = http2VersionRegex_1.exec(request.httpVersion) ? name.toLocaleLowerCase() : name;
89
+ return __assign(__assign({}, accumulator), (_b = {}, _b[headerName] = value, _b));
90
+ }, {});
91
+ }
92
+ // construct headers objects
93
+ if (request.cookies && request.cookies.length) {
94
+ request.cookiesObj = request.cookies.reduceRight(function (accumulator, _a) {
95
+ var _b;
96
+ var name = _a.name, value = _a.value;
97
+ return (__assign(__assign({}, accumulator), (_b = {}, _b[name] = value, _b)));
98
+ }, {});
99
+ }
100
+ // construct Cookie header
101
+ var cookies = (_b = request.cookies) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
102
+ var name = _a.name, value = _a.value;
103
+ if (options.harIsAlreadyEncoded) {
104
+ return "".concat(name, "=").concat(value);
105
+ }
106
+ return "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(value));
107
+ });
108
+ if (cookies === null || cookies === void 0 ? void 0 : cookies.length) {
109
+ request.allHeaders.cookie = cookies.join('; ');
110
+ }
111
+ switch (request.postData.mimeType) {
112
+ case 'multipart/mixed':
113
+ case 'multipart/related':
114
+ case 'multipart/form-data':
115
+ case 'multipart/alternative':
116
+ // reset values
117
+ request.postData.text = '';
118
+ request.postData.mimeType = 'multipart/form-data';
119
+ if ((_c = request.postData) === null || _c === void 0 ? void 0 : _c.params) {
120
+ var form_1 = new form_data_1["default"]();
121
+ // The `form-data` module returns one of two things: a native FormData object, or its own polyfill
122
+ // 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:
123
+ //
124
+ // 1. The API for `form.append()` has three arguments and the third should only be present when the second is a
125
+ // Blob or USVString.
126
+ // 1. `FormData.pipe()` isn't a function.
127
+ //
128
+ // Since the native FormData object is iterable, we easily detect what version of `form-data` we're working with here to allow `multipart/form-data` requests to be compiled under both browser and Node environments.
129
+ //
130
+ // This hack is pretty awful but it's the only way we can use this library in the browser as if we code this against just the native FormData object, we can't polyfill that back into Node because Blob and File objects, which something like `formdata-polyfill` requires, don't exist there.
131
+ // @ts-expect-error TODO
132
+ var isNativeFormData_1 = typeof form_1[Symbol.iterator] === 'function';
133
+ // TODO: THIS ABSOLUTELY MUST BE REMOVED.
134
+ // IT BREAKS SOME USE-CASES FOR MULTIPART FORMS THAT DEPEND ON BEING ABLE TO SET THE BOUNDARY.
135
+ // easter egg
136
+ var boundary = '---011000010111000001101001'; // this is binary for "api". yep.
137
+ if (!isNativeFormData_1) {
138
+ // @ts-expect-error THIS IS WRONG. VERY WRONG.
139
+ form_1._boundary = boundary;
140
+ }
141
+ (_d = request.postData) === null || _d === void 0 ? void 0 : _d.params.forEach(function (param) {
142
+ var name = param.name;
143
+ var value = param.value || '';
144
+ var filename = param.fileName || null;
145
+ if (isNativeFormData_1) {
146
+ if ((0, form_data_2.isBlob)(value)) {
147
+ // @ts-expect-error TODO
148
+ form_1.append(name, value, filename);
149
+ }
150
+ else {
151
+ form_1.append(name, value);
152
+ }
153
+ }
154
+ else {
155
+ form_1.append(name, value, {
156
+ // @ts-expect-error TODO
157
+ filename: filename,
158
+ // @ts-expect-error TODO
159
+ contentType: param.contentType || null
160
+ });
161
+ }
162
+ });
163
+ if (isNativeFormData_1) {
164
+ try {
165
+ // eslint-disable-next-line no-restricted-syntax
166
+ for (var _e = __values((0, form_data_2.formDataIterator)(form_1, boundary)), _f = _e.next(); !_f.done; _f = _e.next()) {
167
+ var data_1 = _f.value;
168
+ request.postData.text += data_1;
169
+ }
170
+ }
171
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
172
+ finally {
173
+ try {
174
+ if (_f && !_f.done && (_a = _e["return"])) _a.call(_e);
175
+ }
176
+ finally { if (e_1) throw e_1.error; }
177
+ }
178
+ }
179
+ else {
180
+ form_1.pipe(
181
+ // @ts-expect-error TODO
182
+ (0, event_stream_1.map)(function (data) {
183
+ request.postData.text += data;
184
+ }));
185
+ }
186
+ request.postData.boundary = boundary;
187
+ // Since headers are case-sensitive we need to see if there's an existing `Content-Type` header that we can override.
188
+ var contentTypeHeader = (0, headers_1.getHeaderName)(request.headersObj, 'content-type') || 'content-type';
189
+ request.headersObj[contentTypeHeader] = "multipart/form-data; boundary=".concat(boundary);
190
+ }
191
+ break;
192
+ case 'application/x-www-form-urlencoded':
193
+ if (!request.postData.params) {
194
+ request.postData.text = '';
195
+ }
196
+ else {
197
+ // @ts-expect-error the `har-format` types make this challenging
198
+ request.postData.paramsObj = request.postData.params.reduce(reducer_1.reducer, {});
199
+ // always overwrite
200
+ request.postData.text = (0, qs_1.stringify)(request.postData.paramsObj);
201
+ }
202
+ break;
203
+ case 'text/json':
204
+ case 'text/x-json':
205
+ case 'application/json':
206
+ case 'application/x-json':
207
+ request.postData.mimeType = 'application/json';
208
+ if (request.postData.text) {
209
+ try {
210
+ request.postData.jsonObj = JSON.parse(request.postData.text);
211
+ }
212
+ catch (e) {
213
+ debug.info(e);
214
+ // force back to `text/plain` if headers have proper content-type value, then this should also work
215
+ request.postData.mimeType = 'text/plain';
216
+ }
217
+ }
218
+ break;
219
+ }
220
+ // create allHeaders object
221
+ var allHeaders = __assign(__assign({}, request.allHeaders), request.headersObj);
222
+ var urlWithParsedQuery = (0, url_1.parse)(request.url, true, true); //?
223
+ // query string key/value pairs in with literal querystrings containd within the url
224
+ request.queryObj = __assign(__assign({}, request.queryObj), urlWithParsedQuery.query); //?
225
+ // reset uriObj values for a clean url
226
+ var search;
227
+ if (options.harIsAlreadyEncoded) {
228
+ search = (0, qs_1.stringify)(request.queryObj, {
229
+ encode: false,
230
+ indices: false
231
+ });
232
+ }
233
+ else {
234
+ search = (0, qs_1.stringify)(request.queryObj, {
235
+ indices: false
236
+ });
237
+ }
238
+ var uriObj = __assign(__assign({}, urlWithParsedQuery), { query: request.queryObj, search: search, path: search ? "".concat(urlWithParsedQuery.pathname, "?").concat(search) : urlWithParsedQuery.pathname });
239
+ // keep the base url clean of queryString
240
+ var url = (0, url_1.format)(__assign(__assign({}, urlWithParsedQuery), { query: null, search: null })); //?
241
+ var fullUrl = (0, url_1.format)(__assign(__assign({}, urlWithParsedQuery), uriObj)); //?
242
+ return __assign(__assign({}, request), { allHeaders: allHeaders, fullUrl: fullUrl, url: url, uriObj: uriObj });
243
+ };
244
+ this.convert = function (targetId, clientId, options) {
245
+ if (!options && clientId) {
246
+ options = clientId;
247
+ }
248
+ var target = targets_1.targets[targetId];
249
+ if (!target) {
250
+ return false;
251
+ }
252
+ var convert = target.clientsById[clientId || target.info["default"]].convert;
253
+ var results = _this.requests.map(function (request) { return convert(request, options); });
254
+ return results.length === 1 ? results[0] : results;
255
+ };
256
+ var entries = [];
257
+ var options = __assign({ harIsAlreadyEncoded: false }, opts);
258
+ // prep the main container
259
+ this.requests = [];
260
+ // is it har?
261
+ if (isHarEntry(input)) {
262
+ entries = input.log.entries;
263
+ }
264
+ else {
265
+ entries = [
266
+ {
267
+ request: input
268
+ },
269
+ ];
270
+ }
271
+ entries.forEach(function (_a) {
272
+ var _b;
273
+ var request = _a.request;
274
+ // add optional properties to make validation successful
275
+ var req = __assign({ bodySize: 0, headersSize: 0, headers: [], cookies: [], httpVersion: 'HTTP/1.1', queryString: [], postData: {
276
+ mimeType: ((_b = request.postData) === null || _b === void 0 ? void 0 : _b.mimeType) || 'application/octet-stream'
277
+ } }, request);
278
+ if ((0, har_validator_1.validateHarRequest)(req)) {
279
+ _this.requests.push(_this.prepare(req, options));
280
+ }
281
+ });
282
+ }
283
+ return HTTPSnippet;
284
+ }());
285
+ exports.HTTPSnippet = HTTPSnippet;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.libcurl = void 0;
4
+ var code_builder_1 = require("../../../helpers/code-builder");
5
+ exports.libcurl = {
6
+ info: {
7
+ key: 'libcurl',
8
+ title: 'Libcurl',
9
+ link: 'http://curl.haxx.se/libcurl',
10
+ description: 'Simple REST and HTTP API Client for C'
11
+ },
12
+ convert: function (_a) {
13
+ var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
14
+ var _b = new code_builder_1.CodeBuilder(), push = _b.push, blank = _b.blank, join = _b.join;
15
+ push('CURL *hnd = curl_easy_init();');
16
+ blank();
17
+ push("curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"".concat(method.toUpperCase(), "\");"));
18
+ push("curl_easy_setopt(hnd, CURLOPT_URL, \"".concat(fullUrl, "\");"));
19
+ // Add headers, including the cookies
20
+ var headers = Object.keys(headersObj);
21
+ // construct headers
22
+ if (headers.length) {
23
+ blank();
24
+ push('struct curl_slist *headers = NULL;');
25
+ headers.forEach(function (header) {
26
+ push("headers = curl_slist_append(headers, \"".concat(header, ": ").concat(headersObj[header], "\");"));
27
+ });
28
+ push('curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);');
29
+ }
30
+ // construct cookies
31
+ if (allHeaders.cookie) {
32
+ blank();
33
+ push("curl_easy_setopt(hnd, CURLOPT_COOKIE, \"".concat(allHeaders.cookie, "\");"));
34
+ }
35
+ if (postData.text) {
36
+ blank();
37
+ push("curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ".concat(JSON.stringify(postData.text), ");"));
38
+ }
39
+ blank();
40
+ push('CURLcode ret = curl_easy_perform(hnd);');
41
+ return join();
42
+ }
43
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ exports.__esModule = 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
+ },
12
+ clientsById: {
13
+ libcurl: client_1.libcurl
14
+ }
15
+ };
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * @description
4
+ * HTTP code snippet generator for Clojure using clj-http.
5
+ *
6
+ * @author
7
+ * @tggreene
8
+ *
9
+ * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
10
+ */
11
+ exports.__esModule = true;
12
+ exports.clj_http = void 0;
13
+ var code_builder_1 = require("../../../helpers/code-builder");
14
+ var headers_1 = require("../../../helpers/headers");
15
+ var Keyword = /** @class */ (function () {
16
+ function Keyword(name) {
17
+ var _this = this;
18
+ this.name = '';
19
+ this.toString = function () { return ":".concat(_this.name); };
20
+ this.name = name;
21
+ }
22
+ return Keyword;
23
+ }());
24
+ var File = /** @class */ (function () {
25
+ function File(path) {
26
+ var _this = this;
27
+ this.path = '';
28
+ this.toString = function () { return "(clojure.java.io/file \"".concat(_this.path, "\")"); };
29
+ this.path = path;
30
+ }
31
+ return File;
32
+ }());
33
+ var jsType = function (input) {
34
+ if (input === undefined) {
35
+ return null;
36
+ }
37
+ if (input === null) {
38
+ return 'null';
39
+ }
40
+ return input.constructor.name.toLowerCase();
41
+ };
42
+ var objEmpty = function (input) {
43
+ if (jsType(input) === 'object') {
44
+ return Object.keys(input).length === 0;
45
+ }
46
+ return false;
47
+ };
48
+ var filterEmpty = function (input) {
49
+ Object.keys(input)
50
+ .filter(function (x) { return objEmpty(input[x]); })
51
+ .forEach(function (x) {
52
+ delete input[x];
53
+ });
54
+ return input;
55
+ };
56
+ var padBlock = function (padSize, input) {
57
+ var padding = ' '.repeat(padSize);
58
+ return input.replace(/\n/g, "\n".concat(padding));
59
+ };
60
+ var jsToEdn = function (js) {
61
+ switch (jsType(js)) {
62
+ case 'string':
63
+ return "\"".concat(js.replace(/"/g, '\\"'), "\"");
64
+ case 'file':
65
+ return js.toString();
66
+ case 'keyword':
67
+ return js.toString();
68
+ case 'null':
69
+ return 'nil';
70
+ case 'regexp':
71
+ return "#\"".concat(js.source, "\"");
72
+ case 'object': {
73
+ // simple vertical format
74
+ var obj = Object.keys(js)
75
+ .reduce(function (accumulator, key) {
76
+ var val = padBlock(key.length + 2, jsToEdn(js[key]));
77
+ return "".concat(accumulator, ":").concat(key, " ").concat(val, "\n ");
78
+ }, '')
79
+ .trim();
80
+ return "{".concat(padBlock(1, obj), "}");
81
+ }
82
+ case 'array': {
83
+ // simple horizontal format
84
+ var arr = js.reduce(function (accumulator, value) { return "".concat(accumulator, " ").concat(jsToEdn(value)); }, '').trim();
85
+ return "[".concat(padBlock(1, arr), "]");
86
+ }
87
+ default: // 'number' 'boolean'
88
+ return js.toString();
89
+ }
90
+ };
91
+ exports.clj_http = {
92
+ info: {
93
+ key: 'clj_http',
94
+ title: 'clj-http',
95
+ link: 'https://github.com/dakrone/clj-http',
96
+ description: 'An idiomatic clojure http client wrapping the apache client.'
97
+ },
98
+ convert: function (_a, options) {
99
+ var queryObj = _a.queryObj, method = _a.method, postData = _a.postData, url = _a.url, allHeaders = _a.allHeaders;
100
+ var _b = new code_builder_1.CodeBuilder({ indent: options === null || options === void 0 ? void 0 : options.indent }), push = _b.push, join = _b.join;
101
+ var methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
102
+ method = method.toLowerCase();
103
+ if (!methods.includes(method)) {
104
+ push('Method not supported');
105
+ return join();
106
+ }
107
+ var params = {
108
+ headers: allHeaders,
109
+ 'query-params': queryObj
110
+ };
111
+ switch (postData.mimeType) {
112
+ case 'application/json':
113
+ {
114
+ params['content-type'] = new Keyword('json');
115
+ params['form-params'] = postData.jsonObj;
116
+ var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
117
+ if (header) {
118
+ delete params.headers[header];
119
+ }
120
+ }
121
+ break;
122
+ case 'application/x-www-form-urlencoded':
123
+ {
124
+ params['form-params'] = postData.paramsObj;
125
+ var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
126
+ if (header) {
127
+ delete params.headers[header];
128
+ }
129
+ }
130
+ break;
131
+ case 'text/plain':
132
+ {
133
+ params.body = postData.text;
134
+ var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
135
+ if (header) {
136
+ delete params.headers[header];
137
+ }
138
+ }
139
+ break;
140
+ case 'multipart/form-data': {
141
+ if (postData.params) {
142
+ params.multipart = postData.params.map(function (param) {
143
+ if (param.fileName && !param.value) {
144
+ return {
145
+ name: param.name,
146
+ content: new File(param.fileName)
147
+ };
148
+ }
149
+ return {
150
+ name: param.name,
151
+ content: param.value
152
+ };
153
+ });
154
+ var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
155
+ if (header) {
156
+ delete params.headers[header];
157
+ }
158
+ }
159
+ break;
160
+ }
161
+ }
162
+ switch ((0, headers_1.getHeader)(params.headers, 'accept')) {
163
+ case 'application/json':
164
+ {
165
+ params.accept = new Keyword('json');
166
+ var header = (0, headers_1.getHeaderName)(params.headers, 'accept');
167
+ if (header) {
168
+ delete params.headers[header];
169
+ }
170
+ }
171
+ break;
172
+ }
173
+ push("(require '[clj-http.client :as client])\n");
174
+ if (objEmpty(filterEmpty(params))) {
175
+ push("(client/".concat(method, " \"").concat(url, "\")"));
176
+ }
177
+ else {
178
+ var padding = 11 + method.length + url.length;
179
+ var formattedParams = padBlock(padding, jsToEdn(filterEmpty(params)));
180
+ push("(client/".concat(method, " \"").concat(url, "\" ").concat(formattedParams, ")"));
181
+ }
182
+ return join();
183
+ }
184
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ exports.__esModule = 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
+ };