@scalar/snippetz 0.2.19 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients.js +153 -155
- package/dist/clients.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js +44 -59
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.js +41 -69
- package/dist/httpsnippet-lite/esm/helpers/escape.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js +59 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.js +23 -18
- package/dist/httpsnippet-lite/esm/helpers/headers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.js +13 -16
- package/dist/httpsnippet-lite/esm/helpers/shell.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js +16 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +72 -40
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +149 -166
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +165 -161
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +47 -46
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js +167 -116
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +41 -43
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +79 -84
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +76 -83
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +78 -79
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +70 -77
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js +100 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js +24 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +36 -52
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +157 -128
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +50 -65
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +72 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js +85 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js +127 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js +61 -49
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +68 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +71 -90
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +99 -124
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +69 -69
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +106 -113
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js +20 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +42 -51
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +51 -67
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +132 -133
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js +28 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js +19 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js.map +7 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +7 -0
- package/dist/plugins/c/libcurl/index.js +2 -1
- package/dist/plugins/c/libcurl/index.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.js +12 -15
- package/dist/plugins/c/libcurl/libcurl.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.test.js +208 -0
- package/dist/plugins/c/libcurl/libcurl.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.js +12 -15
- package/dist/plugins/clojure/clj_http/clj_http.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js +151 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/index.js +2 -1
- package/dist/plugins/clojure/clj_http/index.js.map +7 -0
- package/dist/plugins/csharp/httpclient/httpclient.js +12 -15
- package/dist/plugins/csharp/httpclient/httpclient.js.map +7 -0
- package/dist/plugins/csharp/httpclient/index.js +2 -1
- package/dist/plugins/csharp/httpclient/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/index.js +2 -1
- package/dist/plugins/csharp/restsharp/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/restsharp.js +12 -15
- package/dist/plugins/csharp/restsharp/restsharp.js.map +7 -0
- package/dist/plugins/dart/http/http.js +92 -96
- package/dist/plugins/dart/http/http.js.map +7 -0
- package/dist/plugins/dart/http/http.test.js +550 -0
- package/dist/plugins/dart/http/http.test.js.map +7 -0
- package/dist/plugins/dart/http/index.js +2 -1
- package/dist/plugins/dart/http/index.js.map +7 -0
- package/dist/plugins/go/native/index.js +2 -1
- package/dist/plugins/go/native/index.js.map +7 -0
- package/dist/plugins/go/native/native.js +12 -15
- package/dist/plugins/go/native/native.js.map +7 -0
- package/dist/plugins/go/native/native.test.js +366 -0
- package/dist/plugins/go/native/native.test.js.map +7 -0
- package/dist/plugins/http/http11/http11.js +84 -104
- package/dist/plugins/http/http11/http11.js.map +7 -0
- package/dist/plugins/http/http11/http11.test.js +175 -0
- package/dist/plugins/http/http11/http11.test.js.map +7 -0
- package/dist/plugins/http/http11/index.js +2 -1
- package/dist/plugins/http/http11/index.js.map +7 -0
- package/dist/plugins/java/asynchttp/asynchttp.js +12 -15
- package/dist/plugins/java/asynchttp/asynchttp.js.map +7 -0
- package/dist/plugins/java/asynchttp/index.js +2 -1
- package/dist/plugins/java/asynchttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/index.js +2 -1
- package/dist/plugins/java/nethttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/nethttp.js +12 -15
- package/dist/plugins/java/nethttp/nethttp.js.map +7 -0
- package/dist/plugins/java/okhttp/index.js +2 -1
- package/dist/plugins/java/okhttp/index.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.js +12 -15
- package/dist/plugins/java/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/java/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/java/unirest/index.js +2 -1
- package/dist/plugins/java/unirest/index.js.map +7 -0
- package/dist/plugins/java/unirest/unirest.js +12 -15
- package/dist/plugins/java/unirest/unirest.js.map +7 -0
- package/dist/plugins/js/axios/axios.js +12 -15
- package/dist/plugins/js/axios/axios.js.map +7 -0
- package/dist/plugins/js/axios/index.d.ts +1 -1
- package/dist/plugins/js/axios/index.d.ts.map +1 -1
- package/dist/plugins/js/axios/index.js +5 -1
- package/dist/plugins/js/axios/index.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +67 -60
- package/dist/plugins/js/fetch/fetch.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.test.js +214 -0
- package/dist/plugins/js/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/js/fetch/index.d.ts +1 -1
- package/dist/plugins/js/fetch/index.d.ts.map +1 -1
- package/dist/plugins/js/fetch/index.js +5 -1
- package/dist/plugins/js/fetch/index.js.map +7 -0
- package/dist/plugins/js/jquery/index.js +2 -1
- package/dist/plugins/js/jquery/index.js.map +7 -0
- package/dist/plugins/js/jquery/jquery.js +12 -15
- package/dist/plugins/js/jquery/jquery.js.map +7 -0
- package/dist/plugins/js/ofetch/index.js +2 -1
- package/dist/plugins/js/ofetch/index.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +44 -67
- package/dist/plugins/js/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/js/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/js/xhr/index.js +2 -1
- package/dist/plugins/js/xhr/index.js.map +7 -0
- package/dist/plugins/js/xhr/xhr.js +12 -15
- package/dist/plugins/js/xhr/xhr.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/index.js +2 -1
- package/dist/plugins/kotlin/okhttp/index.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.js +12 -15
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/node/axios/axios.js +12 -15
- package/dist/plugins/node/axios/axios.js.map +7 -0
- package/dist/plugins/node/axios/index.js +2 -1
- package/dist/plugins/node/axios/index.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +73 -59
- package/dist/plugins/node/fetch/fetch.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.test.js +200 -0
- package/dist/plugins/node/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/node/fetch/index.js +2 -1
- package/dist/plugins/node/fetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/index.js +2 -1
- package/dist/plugins/node/ofetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +44 -67
- package/dist/plugins/node/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/node/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/node/undici/index.js +2 -1
- package/dist/plugins/node/undici/index.js.map +7 -0
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +46 -62
- package/dist/plugins/node/undici/undici.js.map +7 -0
- package/dist/plugins/node/undici/undici.test.js +133 -0
- package/dist/plugins/node/undici/undici.test.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/index.js +2 -1
- package/dist/plugins/objc/nsurlsession/index.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/cohttp.js +12 -15
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/index.js +2 -1
- package/dist/plugins/ocaml/cohttp/index.js.map +7 -0
- package/dist/plugins/php/curl/curl.js +119 -157
- package/dist/plugins/php/curl/curl.js.map +7 -0
- package/dist/plugins/php/curl/curl.test.js +564 -0
- package/dist/plugins/php/curl/curl.test.js.map +7 -0
- package/dist/plugins/php/curl/index.js +2 -1
- package/dist/plugins/php/curl/index.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.js +115 -148
- package/dist/plugins/php/guzzle/guzzle.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.test.js +546 -0
- package/dist/plugins/php/guzzle/guzzle.test.js.map +7 -0
- package/dist/plugins/php/guzzle/index.js +2 -1
- package/dist/plugins/php/guzzle/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/index.js +2 -1
- package/dist/plugins/powershell/restmethod/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/restmethod.js +12 -15
- package/dist/plugins/powershell/restmethod/restmethod.js.map +7 -0
- package/dist/plugins/powershell/webrequest/index.js +2 -1
- package/dist/plugins/powershell/webrequest/index.js.map +7 -0
- package/dist/plugins/powershell/webrequest/webrequest.js +12 -15
- package/dist/plugins/powershell/webrequest/webrequest.js.map +7 -0
- package/dist/plugins/python/python3/index.js +2 -1
- package/dist/plugins/python/python3/index.js.map +7 -0
- package/dist/plugins/python/python3/python3.js +12 -15
- package/dist/plugins/python/python3/python3.js.map +7 -0
- package/dist/plugins/python/requests/index.js +2 -1
- package/dist/plugins/python/requests/index.js.map +7 -0
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js +98 -126
- package/dist/plugins/python/requests/requests.js.map +7 -0
- package/dist/plugins/python/requests/requests.test.js +419 -0
- package/dist/plugins/python/requests/requests.test.js.map +7 -0
- package/dist/plugins/r/httr/httr.js +12 -15
- package/dist/plugins/r/httr/httr.js.map +7 -0
- package/dist/plugins/r/httr/index.js +2 -1
- package/dist/plugins/r/httr/index.js.map +7 -0
- package/dist/plugins/ruby/native/index.js +2 -1
- package/dist/plugins/ruby/native/index.js.map +7 -0
- package/dist/plugins/ruby/native/native.js +12 -15
- package/dist/plugins/ruby/native/native.js.map +7 -0
- package/dist/plugins/ruby/native/native.test.js +240 -0
- package/dist/plugins/ruby/native/native.test.js.map +7 -0
- package/dist/plugins/shell/curl/curl.js +81 -114
- package/dist/plugins/shell/curl/curl.js.map +7 -0
- package/dist/plugins/shell/curl/curl.test.js +427 -0
- package/dist/plugins/shell/curl/curl.test.js.map +7 -0
- package/dist/plugins/shell/curl/index.js +2 -1
- package/dist/plugins/shell/curl/index.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.js +12 -15
- package/dist/plugins/shell/httpie/httpie.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.test.js +113 -0
- package/dist/plugins/shell/httpie/httpie.test.js.map +7 -0
- package/dist/plugins/shell/httpie/index.js +2 -1
- package/dist/plugins/shell/httpie/index.js.map +7 -0
- package/dist/plugins/shell/wget/index.js +2 -1
- package/dist/plugins/shell/wget/index.js.map +7 -0
- package/dist/plugins/shell/wget/wget.js +12 -15
- package/dist/plugins/shell/wget/wget.js.map +7 -0
- package/dist/plugins/shell/wget/wget.test.js +143 -0
- package/dist/plugins/shell/wget/wget.test.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/index.js +2 -1
- package/dist/plugins/swift/nsurlsession/index.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js +344 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js.map +7 -0
- package/dist/snippetz.js +27 -27
- package/dist/snippetz.js.map +7 -0
- package/dist/snippetz.test.js +79 -0
- package/dist/snippetz.test.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.js +101 -104
- package/dist/utils/convertWithHttpSnippetLite.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js +106 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js.map +7 -0
- package/dist/utils/create-search-params.d.ts +4 -0
- package/dist/utils/create-search-params.d.ts.map +1 -0
- package/dist/utils/create-search-params.js +11 -0
- package/dist/utils/create-search-params.js.map +7 -0
- package/dist/utils/create-search-params.test.js +49 -0
- package/dist/utils/create-search-params.test.js.map +7 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/needsQuotes.js +5 -8
- package/dist/utils/needsQuotes.js.map +7 -0
- package/dist/utils/objectToString.d.ts +8 -0
- package/dist/utils/objectToString.d.ts.map +1 -1
- package/dist/utils/objectToString.js +48 -54
- package/dist/utils/objectToString.js.map +7 -0
- package/package.json +147 -151
- package/dist/utils/arrayToObject.d.ts +0 -8
- package/dist/utils/arrayToObject.d.ts.map +0 -1
- package/dist/utils/arrayToObject.js +0 -14
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./snippetz.js";
|
|
2
|
+
export * from "@scalar/types/snippetz";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./libcurl.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { libcurl } from
|
|
2
|
-
import { convertWithHttpSnippetLite } from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* c/libcurl
|
|
6
|
-
*/
|
|
1
|
+
import { libcurl } from "../../../httpsnippet-lite/esm/targets/c/libcurl/client.js";
|
|
2
|
+
import { convertWithHttpSnippetLite } from "../../../utils/convertWithHttpSnippetLite.js";
|
|
7
3
|
const cLibcurl = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
4
|
+
target: "c",
|
|
5
|
+
client: "libcurl",
|
|
6
|
+
title: "Libcurl",
|
|
7
|
+
generate(request) {
|
|
8
|
+
return convertWithHttpSnippetLite(libcurl, request);
|
|
9
|
+
}
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export {
|
|
12
|
+
cLibcurl
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=libcurl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/plugins/c/libcurl/libcurl.ts"],
|
|
4
|
+
"sourcesContent": ["import { libcurl } from '@/httpsnippet-lite/esm/targets/c/libcurl/client'\nimport { convertWithHttpSnippetLite } from '@/utils/convertWithHttpSnippetLite'\nimport type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * c/libcurl\n */\nexport const cLibcurl: Plugin = {\n target: 'c',\n client: 'libcurl',\n title: 'Libcurl',\n generate(request) {\n // TODO: Write an own converter\n return convertWithHttpSnippetLite(libcurl, request)\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,kCAAkC;AAMpC,MAAM,WAAmB;AAAA,EAC9B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS;AAEhB,WAAO,2BAA2B,SAAS,OAAO;AAAA,EACpD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
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("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
|
+
curl_mime *mime = curl_mime_init(hnd);
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
curl_mimepart *part = curl_mime_addpart(mime);
|
|
82
|
+
curl_mime_name(part, "file");
|
|
83
|
+
curl_mime_filedata(part, "test.txt");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
{
|
|
87
|
+
curl_mimepart *part = curl_mime_addpart(mime);
|
|
88
|
+
curl_mime_name(part, "field");
|
|
89
|
+
curl_mime_data(part, "value", CURL_ZERO_TERMINATED);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime);
|
|
93
|
+
|
|
94
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
it("handles url-encoded form data with special characters", () => {
|
|
98
|
+
const result = cLibcurl.generate({
|
|
99
|
+
url: "https://example.com",
|
|
100
|
+
method: "POST",
|
|
101
|
+
postData: {
|
|
102
|
+
mimeType: "application/x-www-form-urlencoded",
|
|
103
|
+
params: [
|
|
104
|
+
{
|
|
105
|
+
name: "special chars!@#",
|
|
106
|
+
value: "value"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
expect(result).toBe(
|
|
112
|
+
`CURL *hnd = curl_easy_init();
|
|
113
|
+
|
|
114
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
|
|
115
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
|
|
116
|
+
|
|
117
|
+
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "special+chars%21%40%23=value");
|
|
118
|
+
|
|
119
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
it("handles binary data", () => {
|
|
123
|
+
const result = cLibcurl.generate({
|
|
124
|
+
url: "https://example.com",
|
|
125
|
+
method: "POST",
|
|
126
|
+
postData: {
|
|
127
|
+
mimeType: "application/octet-stream",
|
|
128
|
+
text: "binary content"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
expect(result).toBe(
|
|
132
|
+
`CURL *hnd = curl_easy_init();
|
|
133
|
+
|
|
134
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
|
|
135
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
|
|
136
|
+
|
|
137
|
+
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "binary content");
|
|
138
|
+
|
|
139
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
it("handles special characters in URL", () => {
|
|
143
|
+
const result = cLibcurl.generate({
|
|
144
|
+
url: "https://example.com/path with spaces/[brackets]"
|
|
145
|
+
});
|
|
146
|
+
expect(result).toBe(
|
|
147
|
+
`CURL *hnd = curl_easy_init();
|
|
148
|
+
|
|
149
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
|
|
150
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com/path%20with%20spaces/[brackets]");
|
|
151
|
+
|
|
152
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
it("handles multiple headers with same name", () => {
|
|
156
|
+
const result = cLibcurl.generate({
|
|
157
|
+
url: "https://example.com",
|
|
158
|
+
headers: [
|
|
159
|
+
{ name: "X-Custom", value: "value1" },
|
|
160
|
+
{ name: "X-Custom", value: "value2" }
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
expect(result).toBe(
|
|
164
|
+
`CURL *hnd = curl_easy_init();
|
|
165
|
+
|
|
166
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
|
|
167
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
|
|
168
|
+
|
|
169
|
+
struct curl_slist *headers = NULL;
|
|
170
|
+
headers = curl_slist_append(headers, "X-Custom: value2");
|
|
171
|
+
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
|
|
172
|
+
|
|
173
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
it("handles headers with empty values", () => {
|
|
177
|
+
const result = cLibcurl.generate({
|
|
178
|
+
url: "https://example.com",
|
|
179
|
+
headers: [{ name: "X-Empty", value: "" }]
|
|
180
|
+
});
|
|
181
|
+
expect(result).toBe(
|
|
182
|
+
`CURL *hnd = curl_easy_init();
|
|
183
|
+
|
|
184
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
|
|
185
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com");
|
|
186
|
+
|
|
187
|
+
struct curl_slist *headers = NULL;
|
|
188
|
+
headers = curl_slist_append(headers, "X-Empty;");
|
|
189
|
+
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
|
|
190
|
+
|
|
191
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
it("handles query string parameters", () => {
|
|
195
|
+
const result = cLibcurl.generate({
|
|
196
|
+
url: "https://example.com/api?param1=value1¶m2=special value¶m3=123"
|
|
197
|
+
});
|
|
198
|
+
expect(result).toBe(
|
|
199
|
+
`CURL *hnd = curl_easy_init();
|
|
200
|
+
|
|
201
|
+
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
|
|
202
|
+
curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com/api?param1=value1¶m2=special%20value¶m3=123");
|
|
203
|
+
|
|
204
|
+
CURLcode ret = curl_easy_perform(hnd);`
|
|
205
|
+
);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
//# sourceMappingURL=libcurl.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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('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\ncurl_mime *mime = curl_mime_init(hnd);\n\n{\n curl_mimepart *part = curl_mime_addpart(mime);\n curl_mime_name(part, \"file\");\n curl_mime_filedata(part, \"test.txt\");\n}\n\n{\n curl_mimepart *part = curl_mime_addpart(mime);\n curl_mime_name(part, \"field\");\n curl_mime_data(part, \"value\", CURL_ZERO_TERMINATED);\n}\n\ncurl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime);\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n\n it('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\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"special+chars%21%40%23=value\");\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('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¶m2=special value¶m3=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¶m2=special%20value¶m3=123\");\n\nCURLcode ret = curl_easy_perform(hnd);`,\n )\n })\n})\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { clj_http } from
|
|
2
|
-
import { convertWithHttpSnippetLite } from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* clojure/clj_http
|
|
6
|
-
*/
|
|
1
|
+
import { clj_http } from "../../../httpsnippet-lite/esm/targets/clojure/clj_http/client.js";
|
|
2
|
+
import { convertWithHttpSnippetLite } from "../../../utils/convertWithHttpSnippetLite.js";
|
|
7
3
|
const clojureCljhttp = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
4
|
+
target: "clojure",
|
|
5
|
+
client: "clj_http",
|
|
6
|
+
title: "clj-http",
|
|
7
|
+
generate(request) {
|
|
8
|
+
return convertWithHttpSnippetLite(clj_http, request);
|
|
9
|
+
}
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export {
|
|
12
|
+
clojureCljhttp
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=clj_http.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/plugins/clojure/clj_http/clj_http.ts"],
|
|
4
|
+
"sourcesContent": ["import { clj_http } from '@/httpsnippet-lite/esm/targets/clojure/clj_http/client'\nimport { convertWithHttpSnippetLite } from '@/utils/convertWithHttpSnippetLite'\nimport type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * clojure/clj_http\n */\nexport const clojureCljhttp: Plugin = {\n target: 'clojure',\n client: 'clj_http',\n title: 'clj-http',\n generate(request) {\n // TODO: Write an own converter\n return convertWithHttpSnippetLite(clj_http, request)\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,kCAAkC;AAMpC,MAAM,iBAAyB;AAAA,EACpC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS;AAEhB,WAAO,2BAA2B,UAAU,OAAO;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
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¶m2=special value¶m3=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
|
|
@@ -0,0 +1,7 @@
|
|
|
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¶m2=special value¶m3=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": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./clj_http.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { httpclient } from
|
|
2
|
-
import { convertWithHttpSnippetLite } from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* csharp/httpclient
|
|
6
|
-
*/
|
|
1
|
+
import { httpclient } from "../../../httpsnippet-lite/esm/targets/csharp/httpclient/client.js";
|
|
2
|
+
import { convertWithHttpSnippetLite } from "../../../utils/convertWithHttpSnippetLite.js";
|
|
7
3
|
const csharpHttpclient = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
4
|
+
target: "csharp",
|
|
5
|
+
client: "httpclient",
|
|
6
|
+
title: "HttpClient",
|
|
7
|
+
generate(request) {
|
|
8
|
+
return convertWithHttpSnippetLite(httpclient, request);
|
|
9
|
+
}
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export {
|
|
12
|
+
csharpHttpclient
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=httpclient.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/plugins/csharp/httpclient/httpclient.ts"],
|
|
4
|
+
"sourcesContent": ["import { httpclient } from '@/httpsnippet-lite/esm/targets/csharp/httpclient/client'\nimport { convertWithHttpSnippetLite } from '@/utils/convertWithHttpSnippetLite'\nimport type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * csharp/httpclient\n */\nexport const csharpHttpclient: Plugin = {\n target: 'csharp',\n client: 'httpclient',\n title: 'HttpClient',\n generate(request) {\n // TODO: Write an own converter\n return convertWithHttpSnippetLite(httpclient, request)\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,kCAAkC;AAMpC,MAAM,mBAA2B;AAAA,EACtC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS;AAEhB,WAAO,2BAA2B,YAAY,OAAO;AAAA,EACvD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./httpclient.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./restsharp.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { restsharp } from
|
|
2
|
-
import { convertWithHttpSnippetLite } from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* csharp/restsharp
|
|
6
|
-
*/
|
|
1
|
+
import { restsharp } from "../../../httpsnippet-lite/esm/targets/csharp/restsharp/client.js";
|
|
2
|
+
import { convertWithHttpSnippetLite } from "../../../utils/convertWithHttpSnippetLite.js";
|
|
7
3
|
const csharpRestsharp = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
4
|
+
target: "csharp",
|
|
5
|
+
client: "restsharp",
|
|
6
|
+
title: "RestSharp",
|
|
7
|
+
generate(request) {
|
|
8
|
+
return convertWithHttpSnippetLite(restsharp, request);
|
|
9
|
+
}
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export {
|
|
12
|
+
csharpRestsharp
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=restsharp.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/plugins/csharp/restsharp/restsharp.ts"],
|
|
4
|
+
"sourcesContent": ["import { restsharp } from '@/httpsnippet-lite/esm/targets/csharp/restsharp/client'\nimport { convertWithHttpSnippetLite } from '@/utils/convertWithHttpSnippetLite'\nimport type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * csharp/restsharp\n */\nexport const csharpRestsharp: Plugin = {\n target: 'csharp',\n client: 'restsharp',\n title: 'RestSharp',\n generate(request) {\n // TODO: Write an own converter\n return convertWithHttpSnippetLite(restsharp, request)\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,kCAAkC;AAMpC,MAAM,kBAA0B;AAAA,EACrC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS;AAEhB,WAAO,2BAA2B,WAAW,OAAO;AAAA,EACtD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|