@scalar/snippetz 0.2.20 → 0.3.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 (118) hide show
  1. package/dist/clients.d.ts.map +1 -1
  2. package/dist/clients.js +2 -1
  3. package/dist/clients.js.map +2 -2
  4. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -1
  5. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +37 -8
  6. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +2 -2
  7. package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -1
  8. package/dist/httpsnippet-lite/esm/targets/go/native/client.js +76 -30
  9. package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +2 -2
  10. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -1
  11. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +25 -9
  12. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +2 -2
  13. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -1
  14. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +25 -9
  15. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +2 -2
  16. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -1
  17. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +11 -0
  18. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +2 -2
  19. package/dist/plugins/js/axios/index.d.ts +1 -1
  20. package/dist/plugins/js/axios/index.d.ts.map +1 -1
  21. package/dist/plugins/js/axios/index.js +4 -1
  22. package/dist/plugins/js/axios/index.js.map +2 -2
  23. package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
  24. package/dist/plugins/js/fetch/fetch.js +30 -9
  25. package/dist/plugins/js/fetch/fetch.js.map +2 -2
  26. package/dist/plugins/js/fetch/index.d.ts +1 -1
  27. package/dist/plugins/js/fetch/index.d.ts.map +1 -1
  28. package/dist/plugins/js/fetch/index.js +4 -1
  29. package/dist/plugins/js/fetch/index.js.map +2 -2
  30. package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
  31. package/dist/plugins/js/ofetch/ofetch.js +1 -10
  32. package/dist/plugins/js/ofetch/ofetch.js.map +2 -2
  33. package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
  34. package/dist/plugins/node/fetch/fetch.js +37 -9
  35. package/dist/plugins/node/fetch/fetch.js.map +2 -2
  36. package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
  37. package/dist/plugins/node/ofetch/ofetch.js +1 -10
  38. package/dist/plugins/node/ofetch/ofetch.js.map +2 -2
  39. package/dist/plugins/node/undici/undici.d.ts.map +1 -1
  40. package/dist/plugins/node/undici/undici.js +4 -6
  41. package/dist/plugins/node/undici/undici.js.map +2 -2
  42. package/dist/plugins/python/httpx/async.d.ts +6 -0
  43. package/dist/plugins/python/httpx/async.d.ts.map +1 -0
  44. package/dist/plugins/python/httpx/async.js +16 -0
  45. package/dist/plugins/python/httpx/async.js.map +7 -0
  46. package/dist/plugins/python/httpx/index.d.ts +3 -0
  47. package/dist/plugins/python/httpx/index.d.ts.map +1 -0
  48. package/dist/plugins/python/httpx/index.js +3 -0
  49. package/dist/plugins/python/httpx/index.js.map +7 -0
  50. package/dist/plugins/python/httpx/sync.d.ts +6 -0
  51. package/dist/plugins/python/httpx/sync.d.ts.map +1 -0
  52. package/dist/plugins/python/httpx/sync.js +13 -0
  53. package/dist/plugins/python/httpx/sync.js.map +7 -0
  54. package/dist/plugins/python/requests/requests.d.ts.map +1 -1
  55. package/dist/plugins/python/requests/requests.js +2 -92
  56. package/dist/plugins/python/requests/requests.js.map +2 -2
  57. package/dist/plugins/python/requestsLike.d.ts +3 -0
  58. package/dist/plugins/python/requestsLike.d.ts.map +1 -0
  59. package/dist/plugins/python/requestsLike.js +120 -0
  60. package/dist/plugins/python/requestsLike.js.map +7 -0
  61. package/dist/snippetz.d.ts +1 -1
  62. package/dist/utils/create-search-params.d.ts +4 -0
  63. package/dist/utils/create-search-params.d.ts.map +1 -0
  64. package/dist/utils/create-search-params.js +11 -0
  65. package/dist/utils/create-search-params.js.map +7 -0
  66. package/dist/utils/index.d.ts +0 -1
  67. package/dist/utils/index.d.ts.map +1 -1
  68. package/dist/utils/index.js +0 -1
  69. package/dist/utils/index.js.map +2 -2
  70. package/dist/utils/objectToString.d.ts +8 -0
  71. package/dist/utils/objectToString.d.ts.map +1 -1
  72. package/dist/utils/objectToString.js +20 -15
  73. package/dist/utils/objectToString.js.map +2 -2
  74. package/package.json +10 -5
  75. package/dist/plugins/c/libcurl/libcurl.test.js +0 -200
  76. package/dist/plugins/c/libcurl/libcurl.test.js.map +0 -7
  77. package/dist/plugins/clojure/clj_http/clj_http.test.js +0 -151
  78. package/dist/plugins/clojure/clj_http/clj_http.test.js.map +0 -7
  79. package/dist/plugins/dart/http/http.test.js +0 -550
  80. package/dist/plugins/dart/http/http.test.js.map +0 -7
  81. package/dist/plugins/go/native/native.test.js +0 -367
  82. package/dist/plugins/go/native/native.test.js.map +0 -7
  83. package/dist/plugins/http/http11/http11.test.js +0 -175
  84. package/dist/plugins/http/http11/http11.test.js.map +0 -7
  85. package/dist/plugins/js/fetch/fetch.test.js +0 -111
  86. package/dist/plugins/js/fetch/fetch.test.js.map +0 -7
  87. package/dist/plugins/js/ofetch/ofetch.test.js +0 -123
  88. package/dist/plugins/js/ofetch/ofetch.test.js.map +0 -7
  89. package/dist/plugins/node/fetch/fetch.test.js +0 -111
  90. package/dist/plugins/node/fetch/fetch.test.js.map +0 -7
  91. package/dist/plugins/node/ofetch/ofetch.test.js +0 -123
  92. package/dist/plugins/node/ofetch/ofetch.test.js.map +0 -7
  93. package/dist/plugins/node/undici/undici.test.js +0 -133
  94. package/dist/plugins/node/undici/undici.test.js.map +0 -7
  95. package/dist/plugins/php/curl/curl.test.js +0 -564
  96. package/dist/plugins/php/curl/curl.test.js.map +0 -7
  97. package/dist/plugins/php/guzzle/guzzle.test.js +0 -546
  98. package/dist/plugins/php/guzzle/guzzle.test.js.map +0 -7
  99. package/dist/plugins/python/requests/requests.test.js +0 -390
  100. package/dist/plugins/python/requests/requests.test.js.map +0 -7
  101. package/dist/plugins/ruby/native/native.test.js +0 -240
  102. package/dist/plugins/ruby/native/native.test.js.map +0 -7
  103. package/dist/plugins/shell/curl/curl.test.js +0 -427
  104. package/dist/plugins/shell/curl/curl.test.js.map +0 -7
  105. package/dist/plugins/shell/httpie/httpie.test.js +0 -113
  106. package/dist/plugins/shell/httpie/httpie.test.js.map +0 -7
  107. package/dist/plugins/shell/wget/wget.test.js +0 -143
  108. package/dist/plugins/shell/wget/wget.test.js.map +0 -7
  109. package/dist/plugins/swift/nsurlsession/nsurlsession.test.js +0 -344
  110. package/dist/plugins/swift/nsurlsession/nsurlsession.test.js.map +0 -7
  111. package/dist/snippetz.test.js +0 -79
  112. package/dist/snippetz.test.js.map +0 -7
  113. package/dist/utils/arrayToObject.d.ts +0 -8
  114. package/dist/utils/arrayToObject.d.ts.map +0 -1
  115. package/dist/utils/arrayToObject.js +0 -10
  116. package/dist/utils/arrayToObject.js.map +0 -7
  117. package/dist/utils/convertWithHttpSnippetLite.test.js +0 -106
  118. package/dist/utils/convertWithHttpSnippetLite.test.js.map +0 -7
@@ -1,200 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { cLibcurl } from "./libcurl.js";
3
- describe("cLibcurl", () => {
4
- it("returns a basic request", () => {
5
- const result = cLibcurl.generate({
6
- url: "https://example.com"
7
- });
8
- expect(result).toBe(
9
- `CURL *hnd = curl_easy_init();
10
-
11
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
12
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
13
-
14
- CURLcode ret = curl_easy_perform(hnd);`
15
- );
16
- });
17
- it("returns a POST request", () => {
18
- const result = cLibcurl.generate({
19
- url: "https://example.com",
20
- method: "post"
21
- });
22
- expect(result).toBe(
23
- `CURL *hnd = curl_easy_init();
24
-
25
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
26
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
27
-
28
- CURLcode ret = curl_easy_perform(hnd);`
29
- );
30
- });
31
- it("has headers", () => {
32
- const result = cLibcurl.generate({
33
- url: "https://example.com",
34
- headers: [
35
- {
36
- name: "Content-Type",
37
- value: "application/json"
38
- }
39
- ]
40
- });
41
- expect(result).toBe(
42
- `CURL *hnd = curl_easy_init();
43
-
44
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
45
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
46
-
47
- struct curl_slist *headers = NULL;
48
- headers = curl_slist_append(headers, "Content-Type: application/json");
49
- curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
50
-
51
- CURLcode ret = curl_easy_perform(hnd);`
52
- );
53
- });
54
- it.skip("handles multipart form data with files", () => {
55
- const result = cLibcurl.generate({
56
- url: "https://example.com",
57
- method: "POST",
58
- postData: {
59
- mimeType: "multipart/form-data",
60
- params: [
61
- {
62
- name: "file",
63
- fileName: "test.txt"
64
- },
65
- {
66
- name: "field",
67
- value: "value"
68
- }
69
- ]
70
- }
71
- });
72
- expect(result).toBe(
73
- `CURL *hnd = curl_easy_init();
74
-
75
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
76
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
77
-
78
- struct curl_httppost *formpost = NULL;
79
- struct curl_httppost *lastptr = NULL;
80
-
81
- curl_easy_setopt(hnd, CURLOPT_HTTPPOST, formpost);
82
-
83
- CURLcode ret = curl_easy_perform(hnd);`
84
- );
85
- });
86
- it.skip("handles url-encoded form data with special characters", () => {
87
- const result = cLibcurl.generate({
88
- url: "https://example.com",
89
- method: "POST",
90
- postData: {
91
- mimeType: "application/x-www-form-urlencoded",
92
- params: [
93
- {
94
- name: "special chars!@#",
95
- value: "value"
96
- }
97
- ]
98
- }
99
- });
100
- expect(result).toBe(
101
- `CURL *hnd = curl_easy_init();
102
-
103
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
104
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
105
-
106
- struct curl_httppost *formpost = NULL;
107
- struct curl_httppost *lastptr = NULL;
108
-
109
- curl_easy_setopt(hnd, CURLOPT_HTTPPOST, formpost);
110
-
111
- CURLcode ret = curl_easy_perform(hnd);`
112
- );
113
- });
114
- it("handles binary data", () => {
115
- const result = cLibcurl.generate({
116
- url: "https://example.com",
117
- method: "POST",
118
- postData: {
119
- mimeType: "application/octet-stream",
120
- text: "binary content"
121
- }
122
- });
123
- expect(result).toBe(
124
- `CURL *hnd = curl_easy_init();
125
-
126
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
127
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
128
-
129
- curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "binary content");
130
-
131
- CURLcode ret = curl_easy_perform(hnd);`
132
- );
133
- });
134
- it("handles special characters in URL", () => {
135
- const result = cLibcurl.generate({
136
- url: "https://example.com/path with spaces/[brackets]"
137
- });
138
- expect(result).toBe(
139
- `CURL *hnd = curl_easy_init();
140
-
141
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
142
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com/path%20with%20spaces/[brackets]");
143
-
144
- CURLcode ret = curl_easy_perform(hnd);`
145
- );
146
- });
147
- it("handles multiple headers with same name", () => {
148
- const result = cLibcurl.generate({
149
- url: "https://example.com",
150
- headers: [
151
- { name: "X-Custom", value: "value1" },
152
- { name: "X-Custom", value: "value2" }
153
- ]
154
- });
155
- expect(result).toBe(
156
- `CURL *hnd = curl_easy_init();
157
-
158
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
159
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
160
-
161
- struct curl_slist *headers = NULL;
162
- headers = curl_slist_append(headers, "X-Custom: value2");
163
- curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
164
-
165
- CURLcode ret = curl_easy_perform(hnd);`
166
- );
167
- });
168
- it.skip("handles headers with empty values", () => {
169
- const result = cLibcurl.generate({
170
- url: "https://example.com",
171
- headers: [{ name: "X-Empty", value: "" }]
172
- });
173
- expect(result).toBe(
174
- `CURL *hnd = curl_easy_init();
175
-
176
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
177
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
178
-
179
- struct curl_slist *headers = NULL;
180
- headers = curl_slist_append(headers, "X-Empty: ''");
181
- curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
182
-
183
- CURLcode ret = curl_easy_perform(hnd);`
184
- );
185
- });
186
- it("handles query string parameters", () => {
187
- const result = cLibcurl.generate({
188
- url: "https://example.com/api?param1=value1&param2=special value&param3=123"
189
- });
190
- expect(result).toBe(
191
- `CURL *hnd = curl_easy_init();
192
-
193
- curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
194
- curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com/api?param1=value1&param2=special%20value&param3=123");
195
-
196
- CURLcode ret = curl_easy_perform(hnd);`
197
- );
198
- });
199
- });
200
- //# sourceMappingURL=libcurl.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/plugins/c/libcurl/libcurl.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { cLibcurl } from './libcurl'\n\ndescribe('cLibcurl', () => {\n it('returns a basic request', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('returns a POST request', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n method: 'post',\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('has headers', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n headers: [\n {\n name: 'Content-Type',\n value: 'application/json',\n },\n ],\n })\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it.skip('handles multipart form data with files', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'multipart/form-data',\n params: [\n {\n name: 'file',\n fileName: 'test.txt',\n },\n {\n name: 'field',\n value: 'value',\n },\n ],\n },\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nstruct curl_httppost *formpost = NULL;\nstruct curl_httppost *lastptr = NULL;\n\ncurl_easy_setopt(hnd, CURLOPT_HTTPPOST, formpost);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it.skip('handles url-encoded form data with special characters', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'application/x-www-form-urlencoded',\n params: [\n {\n name: 'special chars!@#',\n value: 'value',\n },\n ],\n },\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nstruct curl_httppost *formpost = NULL;\nstruct curl_httppost *lastptr = NULL;\n\ncurl_easy_setopt(hnd, CURLOPT_HTTPPOST, formpost);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('handles binary data', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'application/octet-stream',\n text: 'binary content',\n },\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"binary content\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('handles special characters in URL', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com/path with spaces/[brackets]',\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com/path%20with%20spaces/[brackets]\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('handles multiple headers with same name', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n headers: [\n { name: 'X-Custom', value: 'value1' },\n { name: 'X-Custom', value: 'value2' },\n ],\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"X-Custom: value2\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it.skip('handles headers with empty values', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com',\n headers: [{ name: 'X-Empty', value: '' }],\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"X-Empty: ''\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('handles query string parameters', () => {\n const result = cLibcurl.generate({\n url: 'https://example.com/api?param1=value1&param2=special value&param3=123',\n })\n\n expect(result).toBe(\n `CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://example.com/api?param1=value1&param2=special%20value&param3=123\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,gBAAgB;AAEzB,SAAS,YAAY,MAAM;AACzB,KAAG,2BAA2B,MAAM;AAClC,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,IACP,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMF;AAAA,EACF,CAAC;AAED,KAAG,0BAA0B,MAAM;AACjC,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,MACL,QAAQ;AAAA,IACV,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMF;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V,MAAM;AAAA,MACR;AAAA,IACF,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQF;AAAA,EACF,CAAC;AAED,KAAG,qCAAqC,MAAM;AAC5C,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,IACP,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMF;AAAA,EACF,CAAC;AAED,KAAG,2CAA2C,MAAM;AAClD,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,MACL,SAAS;AAAA,QACP,EAAE,MAAM,YAAY,OAAO,SAAS;AAAA,QACpC,EAAE,MAAM,YAAY,OAAO,SAAS;AAAA,MACtC;AAAA,IACF,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUF;AAAA,EACF,CAAC;AAED,KAAG,KAAK,qCAAqC,MAAM;AACjD,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,MACL,SAAS,CAAC,EAAE,MAAM,WAAW,OAAO,GAAG,CAAC;AAAA,IAC1C,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUF;AAAA,EACF,CAAC;AAED,KAAG,mCAAmC,MAAM;AAC1C,UAAM,SAAS,SAAS,SAAS;AAAA,MAC/B,KAAK;AAAA,IACP,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMF;AAAA,EACF,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,151 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { clojureCljhttp } from "./clj_http.js";
3
- describe("clojureCljhttp", () => {
4
- it("returns a basic request", () => {
5
- const result = clojureCljhttp.generate({
6
- url: "https://example.com"
7
- });
8
- expect(result).toBe(
9
- `(require '[clj-http.client :as client])
10
-
11
- (client/get "https://example.com")`
12
- );
13
- });
14
- it("returns a POST request", () => {
15
- const result = clojureCljhttp.generate({
16
- url: "https://example.com",
17
- method: "post"
18
- });
19
- expect(result).toBe(
20
- `(require '[clj-http.client :as client])
21
-
22
- (client/post "https://example.com")`
23
- );
24
- });
25
- it("has headers", () => {
26
- const result = clojureCljhttp.generate({
27
- url: "https://example.com",
28
- headers: [
29
- {
30
- name: "Content-Type",
31
- value: "application/json"
32
- }
33
- ]
34
- });
35
- expect(result).toBe(
36
- `(require '[clj-http.client :as client])
37
-
38
- (client/get "https://example.com" {:headers {:Content-Type "application/json"}})`
39
- );
40
- });
41
- it("handles multipart form data with files", () => {
42
- const result = clojureCljhttp.generate({
43
- url: "https://example.com",
44
- method: "POST",
45
- postData: {
46
- mimeType: "multipart/form-data",
47
- params: [
48
- {
49
- name: "file",
50
- fileName: "test.txt"
51
- },
52
- {
53
- name: "field",
54
- value: "value"
55
- }
56
- ]
57
- }
58
- });
59
- expect(result).toBe(
60
- `(require '[clj-http.client :as client])
61
-
62
- (client/post "https://example.com" {:multipart [{:name "file"
63
- :content (clojure.java.io/file "test.txt")} {:name "field"
64
- :content "value"}]})`
65
- );
66
- });
67
- it("handles url-encoded form data with special characters", () => {
68
- const result = clojureCljhttp.generate({
69
- url: "https://example.com",
70
- method: "POST",
71
- postData: {
72
- mimeType: "application/x-www-form-urlencoded",
73
- params: [
74
- {
75
- name: "special chars!@#",
76
- value: "value"
77
- }
78
- ]
79
- }
80
- });
81
- expect(result).toBe(
82
- `(require '[clj-http.client :as client])
83
-
84
- (client/post "https://example.com" {:form-params {:special chars!@# "value"}})`
85
- );
86
- });
87
- it.skip("handles binary data", () => {
88
- const result = clojureCljhttp.generate({
89
- url: "https://example.com",
90
- method: "POST",
91
- postData: {
92
- mimeType: "application/octet-stream",
93
- text: "binary content"
94
- }
95
- });
96
- expect(result).toBe(
97
- `(require '[clj-http.client :as client])
98
-
99
- (client/post "https://example.com" {:body "binary content"
100
- :content-type :application/octet-stream})`
101
- );
102
- });
103
- it("handles special characters in URL", () => {
104
- const result = clojureCljhttp.generate({
105
- url: "https://example.com/path with spaces/[brackets]"
106
- });
107
- expect(result).toBe(
108
- `(require '[clj-http.client :as client])
109
-
110
- (client/get "https://example.com/path%20with%20spaces/[brackets]")`
111
- );
112
- });
113
- it("handles multiple headers with same name", () => {
114
- const result = clojureCljhttp.generate({
115
- url: "https://example.com",
116
- headers: [
117
- { name: "X-Custom", value: "value1" },
118
- { name: "X-Custom", value: "value2" }
119
- ]
120
- });
121
- expect(result).toBe(
122
- `(require '[clj-http.client :as client])
123
-
124
- (client/get "https://example.com" {:headers {:X-Custom "value2"}})`
125
- );
126
- });
127
- it("handles headers with empty values", () => {
128
- const result = clojureCljhttp.generate({
129
- url: "https://example.com",
130
- headers: [{ name: "X-Empty", value: "" }]
131
- });
132
- expect(result).toBe(
133
- `(require '[clj-http.client :as client])
134
-
135
- (client/get "https://example.com" {:headers {:X-Empty ""}})`
136
- );
137
- });
138
- it("handles query string parameters", () => {
139
- const result = clojureCljhttp.generate({
140
- url: "https://example.com/api?param1=value1&param2=special value&param3=123"
141
- });
142
- expect(result).toBe(
143
- `(require '[clj-http.client :as client])
144
-
145
- (client/get "https://example.com/api" {:query-params {:param1 "value1"
146
- :param2 "special value"
147
- :param3 "123"}})`
148
- );
149
- });
150
- });
151
- //# sourceMappingURL=clj_http.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/plugins/clojure/clj_http/clj_http.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { clojureCljhttp } from './clj_http'\n\ndescribe('clojureCljhttp', () => {\n it('returns a basic request', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com\")`,\n )\n })\n\n it('returns a POST request', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n method: 'post',\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/post \"https://example.com\")`,\n )\n })\n\n it('has headers', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n headers: [\n {\n name: 'Content-Type',\n value: 'application/json',\n },\n ],\n })\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com\" {:headers {:Content-Type \"application/json\"}})`,\n )\n })\n\n it('handles multipart form data with files', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'multipart/form-data',\n params: [\n {\n name: 'file',\n fileName: 'test.txt',\n },\n {\n name: 'field',\n value: 'value',\n },\n ],\n },\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/post \"https://example.com\" {:multipart [{:name \"file\"\n :content (clojure.java.io/file \"test.txt\")} {:name \"field\"\n :content \"value\"}]})`,\n )\n })\n\n it('handles url-encoded form data with special characters', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'application/x-www-form-urlencoded',\n params: [\n {\n name: 'special chars!@#',\n value: 'value',\n },\n ],\n },\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/post \"https://example.com\" {:form-params {:special chars!@# \"value\"}})`,\n )\n })\n\n it.skip('handles binary data', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n method: 'POST',\n postData: {\n mimeType: 'application/octet-stream',\n text: 'binary content',\n },\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/post \"https://example.com\" {:body \"binary content\"\n :content-type :application/octet-stream})`,\n )\n })\n\n it('handles special characters in URL', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com/path with spaces/[brackets]',\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com/path%20with%20spaces/[brackets]\")`,\n )\n })\n\n it('handles multiple headers with same name', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n headers: [\n { name: 'X-Custom', value: 'value1' },\n { name: 'X-Custom', value: 'value2' },\n ],\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com\" {:headers {:X-Custom \"value2\"}})`,\n )\n })\n\n it('handles headers with empty values', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com',\n headers: [{ name: 'X-Empty', value: '' }],\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com\" {:headers {:X-Empty \"\"}})`,\n )\n })\n\n it('handles query string parameters', () => {\n const result = clojureCljhttp.generate({\n url: 'https://example.com/api?param1=value1&param2=special value&param3=123',\n })\n\n expect(result).toBe(\n `(require '[clj-http.client :as client])\n\n(client/get \"https://example.com/api\" {:query-params {:param1 \"value1\"\n :param2 \"special value\"\n :param3 \"123\"}})`,\n )\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB,MAAM;AAC/B,KAAG,2BAA2B,MAAM;AAClC,UAAM,SAAS,eAAe,SAAS;AAAA,MACrC,KAAK;AAAA,IACP,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA,IAGF;AAAA,EACF,CAAC;AAED,KAAG,0BAA0B,MAAM;AACjC,UAAM,SAAS,eAAe,SAAS;AAAA,MACrC,KAAK;AAAA,MACL,QAAQ;AAAA,IACV,CAAC;AAED,WAAO,MAAM,EAAE;AAAA,MACb;AAAA;AAAA;AAAA,IAGF;AAAA,EACF,CAAC;AAED,KAAG,eAAe,MAAM;AACtB,UAAM,SAAS,eAAe,SAAS;AAAA,MACrC,KAAK;AAAA,MACL,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,QACT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