@readme/httpsnippet 6.2.1 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-XPUGYZ4Y.mjs +3485 -0
- package/dist/chunk-XPUGYZ4Y.mjs.map +1 -0
- package/dist/index-acc66e3d.d.ts +167 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -95
- package/dist/index.js +3777 -261
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +299 -0
- package/dist/index.mjs.map +1 -0
- package/dist/targets/targets.d.mts +4 -0
- package/dist/targets/targets.d.ts +4 -53
- package/dist/targets/targets.js +3476 -113
- package/dist/targets/targets.js.map +1 -0
- package/dist/targets/targets.mjs +3 -0
- package/dist/targets/targets.mjs.map +1 -0
- package/package.json +40 -14
- package/dist/helpers/code-builder.d.ts +0 -49
- package/dist/helpers/code-builder.js +0 -91
- package/dist/helpers/escape.d.ts +0 -46
- package/dist/helpers/escape.js +0 -101
- package/dist/helpers/form-data.d.ts +0 -30
- package/dist/helpers/form-data.js +0 -157
- package/dist/helpers/headers.d.ts +0 -18
- package/dist/helpers/headers.js +0 -33
- package/dist/helpers/reducer.d.ts +0 -5
- package/dist/helpers/reducer.js +0 -19
- package/dist/helpers/shell.d.ts +0 -6
- package/dist/helpers/shell.js +0 -20
- package/dist/helpers/utils.d.ts +0 -6
- package/dist/helpers/utils.js +0 -21
- package/dist/targets/c/libcurl/client.d.ts +0 -2
- package/dist/targets/c/libcurl/client.js +0 -45
- package/dist/targets/c/target.d.ts +0 -2
- package/dist/targets/c/target.js +0 -16
- package/dist/targets/clojure/clj_http/client.d.ts +0 -11
- package/dist/targets/clojure/clj_http/client.js +0 -178
- package/dist/targets/clojure/target.d.ts +0 -2
- package/dist/targets/clojure/target.js +0 -15
- package/dist/targets/csharp/httpclient/client.d.ts +0 -2
- package/dist/targets/csharp/httpclient/client.js +0 -163
- package/dist/targets/csharp/restsharp/client.d.ts +0 -2
- package/dist/targets/csharp/restsharp/client.js +0 -92
- package/dist/targets/csharp/target.d.ts +0 -2
- package/dist/targets/csharp/target.js +0 -18
- package/dist/targets/go/native/client.d.ts +0 -17
- package/dist/targets/go/native/client.js +0 -103
- package/dist/targets/go/target.d.ts +0 -2
- package/dist/targets/go/target.js +0 -16
- package/dist/targets/http/http1.1/client.d.ts +0 -23
- package/dist/targets/http/http1.1/client.js +0 -69
- package/dist/targets/http/target.d.ts +0 -2
- package/dist/targets/http/target.js +0 -15
- package/dist/targets/java/asynchttp/client.d.ts +0 -11
- package/dist/targets/java/asynchttp/client.js +0 -45
- package/dist/targets/java/nethttp/client.d.ts +0 -14
- package/dist/targets/java/nethttp/client.js +0 -44
- package/dist/targets/java/okhttp/client.d.ts +0 -11
- package/dist/targets/java/okhttp/client.js +0 -71
- package/dist/targets/java/target.d.ts +0 -2
- package/dist/targets/java/target.js +0 -21
- package/dist/targets/java/unirest/client.d.ts +0 -11
- package/dist/targets/java/unirest/client.js +0 -45
- package/dist/targets/javascript/axios/client.d.ts +0 -11
- package/dist/targets/javascript/axios/client.js +0 -92
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +0 -23
- package/dist/targets/javascript/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-json.js +0 -27
- package/dist/targets/javascript/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/cookies.js +0 -19
- package/dist/targets/javascript/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/custom-method.js +0 -15
- package/dist/targets/javascript/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/full.js +0 -27
- package/dist/targets/javascript/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/headers.js +0 -24
- package/dist/targets/javascript/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/http-insecure.js +0 -15
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +0 -20
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +0 -20
- package/dist/targets/javascript/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-data.js +0 -23
- package/dist/targets/javascript/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-file.js +0 -22
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +0 -19
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +0 -22
- package/dist/targets/javascript/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/nested.js +0 -19
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +0 -19
- package/dist/targets/javascript/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query-encoded.js +0 -22
- package/dist/targets/javascript/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query.js +0 -19
- package/dist/targets/javascript/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/short.js +0 -15
- package/dist/targets/javascript/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/text-plain.js +0 -20
- package/dist/targets/javascript/fetch/client.d.ts +0 -15
- package/dist/targets/javascript/fetch/client.js +0 -106
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.d.ts +0 -8
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/application-json.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/application-json.js +0 -17
- package/dist/targets/javascript/fetch/fixtures/cookies.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/cookies.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/custom-method.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/custom-method.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/full.d.ts +0 -10
- package/dist/targets/javascript/fetch/fixtures/full.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/headers.d.ts +0 -9
- package/dist/targets/javascript/fetch/fixtures/headers.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/http-insecure.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/http-insecure.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-data.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-file.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-file.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/nested.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/nested.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query-encoded.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query-encoded.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/short.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/short.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/text-plain.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/text-plain.js +0 -6
- package/dist/targets/javascript/jquery/client.d.ts +0 -11
- package/dist/targets/javascript/jquery/client.js +0 -84
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.d.ts +0 -13
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/application-json.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/application-json.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/cookies.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/cookies.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/custom-method.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/full.d.ts +0 -14
- package/dist/targets/javascript/jquery/fixtures/full.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/headers.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/headers.js +0 -16
- package/dist/targets/javascript/jquery/fixtures/http-insecure.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/multipart-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-data.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/multipart-file.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-file.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/nested.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/nested.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/query-encoded.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/query.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/short.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/short.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/text-plain.d.ts +0 -10
- package/dist/targets/javascript/jquery/fixtures/text-plain.js +0 -14
- package/dist/targets/javascript/target.d.ts +0 -2
- package/dist/targets/javascript/target.js +0 -21
- package/dist/targets/javascript/xhr/client.d.ts +0 -14
- package/dist/targets/javascript/xhr/client.js +0 -83
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/application-json.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-json.js +0 -31
- package/dist/targets/javascript/xhr/fixtures/cookies.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cookies.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/cors.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cors.js +0 -10
- package/dist/targets/javascript/xhr/fixtures/custom-method.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/full.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/full.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/headers.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/headers.js +0 -15
- package/dist/targets/javascript/xhr/fixtures/http-insecure.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/multipart-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-data.js +0 -13
- package/dist/targets/javascript/xhr/fixtures/multipart-file.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-file.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/nested.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/nested.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/query-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/query.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/short.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/short.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/text-plain.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/text-plain.js +0 -12
- package/dist/targets/json/native/client.d.ts +0 -2
- package/dist/targets/json/native/client.js +0 -56
- package/dist/targets/json/target.d.ts +0 -2
- package/dist/targets/json/target.js +0 -15
- package/dist/targets/kotlin/okhttp/client.d.ts +0 -11
- package/dist/targets/kotlin/okhttp/client.js +0 -71
- package/dist/targets/kotlin/target.d.ts +0 -2
- package/dist/targets/kotlin/target.js +0 -15
- package/dist/targets/node/axios/client.d.ts +0 -11
- package/dist/targets/node/axios/client.js +0 -78
- package/dist/targets/node/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-form-encoded.js +0 -20
- package/dist/targets/node/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-json.js +0 -23
- package/dist/targets/node/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/cookies.js +0 -15
- package/dist/targets/node/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/custom-method.js +0 -11
- package/dist/targets/node/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/full.js +0 -23
- package/dist/targets/node/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/headers.js +0 -20
- package/dist/targets/node/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/http-insecure.js +0 -11
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +0 -16
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-data.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-file.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +0 -15
- package/dist/targets/node/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/nested.js +0 -14
- package/dist/targets/node/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/postdata-malformed.js +0 -15
- package/dist/targets/node/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query-encoded.js +0 -14
- package/dist/targets/node/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query.js +0 -14
- package/dist/targets/node/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/short.js +0 -11
- package/dist/targets/node/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/text-plain.js +0 -16
- package/dist/targets/node/fetch/client.d.ts +0 -11
- package/dist/targets/node/fetch/client.js +0 -140
- package/dist/targets/node/fetch/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-form-encoded.js +0 -16
- package/dist/targets/node/fetch/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-json.js +0 -19
- package/dist/targets/node/fetch/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/cookies.js +0 -8
- package/dist/targets/node/fetch/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/custom-method.js +0 -8
- package/dist/targets/node/fetch/fixtures/full.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/full.js +0 -19
- package/dist/targets/node/fetch/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/headers.js +0 -16
- package/dist/targets/node/fetch/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +0 -12
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +0 -12
- package/dist/targets/node/fetch/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-data.js +0 -14
- package/dist/targets/node/fetch/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-file.js +0 -13
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +0 -8
- package/dist/targets/node/fetch/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/node/fetch/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/nested.js +0 -8
- package/dist/targets/node/fetch/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/postdata-malformed.js +0 -8
- package/dist/targets/node/fetch/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query-encoded.js +0 -8
- package/dist/targets/node/fetch/fixtures/query.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query.js +0 -8
- package/dist/targets/node/fetch/fixtures/short.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/short.js +0 -8
- package/dist/targets/node/fetch/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/text-plain.js +0 -8
- package/dist/targets/node/native/client.d.ts +0 -11
- package/dist/targets/node/native/client.js +0 -72
- package/dist/targets/node/native/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-form-encoded.js +0 -24
- package/dist/targets/node/native/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-json.js +0 -30
- package/dist/targets/node/native/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/native/fixtures/cookies.js +0 -22
- package/dist/targets/node/native/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/native/fixtures/custom-method.js +0 -20
- package/dist/targets/node/native/fixtures/full.d.ts +0 -1
- package/dist/targets/node/native/fixtures/full.js +0 -26
- package/dist/targets/node/native/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/native/fixtures/headers.js +0 -25
- package/dist/targets/node/native/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/native/fixtures/http-insecure.js +0 -20
- package/dist/targets/node/native/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-multiline.js +0 -23
- package/dist/targets/node/native/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-null-value.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-data.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-file.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.js +0 -22
- package/dist/targets/node/native/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data.js +0 -23
- package/dist/targets/node/native/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/native/fixtures/nested.js +0 -20
- package/dist/targets/node/native/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/native/fixtures/postdata-malformed.js +0 -22
- package/dist/targets/node/native/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query-encoded.js +0 -20
- package/dist/targets/node/native/fixtures/query.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query.js +0 -20
- package/dist/targets/node/native/fixtures/short.d.ts +0 -1
- package/dist/targets/node/native/fixtures/short.js +0 -20
- package/dist/targets/node/native/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/native/fixtures/text-plain.js +0 -23
- package/dist/targets/node/request/client.d.ts +0 -11
- package/dist/targets/node/request/client.js +0 -107
- package/dist/targets/node/request/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-form-encoded.js +0 -13
- package/dist/targets/node/request/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-json.js +0 -21
- package/dist/targets/node/request/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/request/fixtures/cookies.js +0 -11
- package/dist/targets/node/request/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/request/fixtures/custom-method.js +0 -8
- package/dist/targets/node/request/fixtures/full.d.ts +0 -1
- package/dist/targets/node/request/fixtures/full.js +0 -20
- package/dist/targets/node/request/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/request/fixtures/headers.js +0 -17
- package/dist/targets/node/request/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/request/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/request/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/node/request/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/node/request/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/request/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-file.js +0 -19
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.js +0 -12
- package/dist/targets/node/request/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data.js +0 -13
- package/dist/targets/node/request/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/request/fixtures/nested.js +0 -11
- package/dist/targets/node/request/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/request/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/node/request/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query-encoded.js +0 -11
- package/dist/targets/node/request/fixtures/query.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query.js +0 -11
- package/dist/targets/node/request/fixtures/short.d.ts +0 -1
- package/dist/targets/node/request/fixtures/short.js +0 -8
- package/dist/targets/node/request/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/request/fixtures/text-plain.js +0 -13
- package/dist/targets/node/target.d.ts +0 -2
- package/dist/targets/node/target.js +0 -24
- package/dist/targets/node/unirest/client.d.ts +0 -11
- package/dist/targets/node/unirest/client.js +0 -110
- package/dist/targets/node/unirest/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-form-encoded.js +0 -15
- package/dist/targets/node/unirest/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-json.js +0 -32
- package/dist/targets/node/unirest/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/cookies.js +0 -12
- package/dist/targets/node/unirest/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/custom-method.js +0 -8
- package/dist/targets/node/unirest/fixtures/full.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/full.js +0 -27
- package/dist/targets/node/unirest/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/headers.js +0 -14
- package/dist/targets/node/unirest/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/node/unirest/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/unirest/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-file.js +0 -18
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/node/unirest/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/unirest/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/nested.js +0 -13
- package/dist/targets/node/unirest/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/postdata-malformed.js +0 -11
- package/dist/targets/node/unirest/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query-encoded.js +0 -12
- package/dist/targets/node/unirest/fixtures/query.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query.js +0 -16
- package/dist/targets/node/unirest/fixtures/short.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/short.js +0 -8
- package/dist/targets/node/unirest/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/text-plain.js +0 -12
- package/dist/targets/objc/helpers.d.ts +0 -26
- package/dist/targets/objc/helpers.js +0 -59
- package/dist/targets/objc/nsurlsession/client.d.ts +0 -15
- package/dist/targets/objc/nsurlsession/client.js +0 -143
- package/dist/targets/objc/target.d.ts +0 -2
- package/dist/targets/objc/target.js +0 -15
- package/dist/targets/ocaml/cohttp/client.d.ts +0 -11
- package/dist/targets/ocaml/cohttp/client.js +0 -64
- package/dist/targets/ocaml/target.d.ts +0 -2
- package/dist/targets/ocaml/target.js +0 -15
- package/dist/targets/php/curl/client.d.ts +0 -19
- package/dist/targets/php/curl/client.js +0 -122
- package/dist/targets/php/guzzle/client.d.ts +0 -17
- package/dist/targets/php/guzzle/client.js +0 -119
- package/dist/targets/php/helpers.d.ts +0 -2
- package/dist/targets/php/helpers.js +0 -66
- package/dist/targets/php/http1/client.d.ts +0 -16
- package/dist/targets/php/http1/client.js +0 -76
- package/dist/targets/php/http2/client.d.ts +0 -16
- package/dist/targets/php/http2/client.js +0 -115
- package/dist/targets/php/target.d.ts +0 -2
- package/dist/targets/php/target.js +0 -22
- package/dist/targets/powershell/common.d.ts +0 -3
- package/dist/targets/powershell/common.js +0 -50
- package/dist/targets/powershell/restmethod/client.d.ts +0 -2
- package/dist/targets/powershell/restmethod/client.js +0 -13
- package/dist/targets/powershell/target.d.ts +0 -2
- package/dist/targets/powershell/target.js +0 -17
- package/dist/targets/powershell/webrequest/client.d.ts +0 -2
- package/dist/targets/powershell/webrequest/client.js +0 -13
- package/dist/targets/python/helpers.d.ts +0 -8
- package/dist/targets/python/helpers.js +0 -64
- package/dist/targets/python/requests/client.d.ts +0 -14
- package/dist/targets/python/requests/client.js +0 -162
- package/dist/targets/python/target.d.ts +0 -2
- package/dist/targets/python/target.js +0 -16
- package/dist/targets/r/httr/client.d.ts +0 -11
- package/dist/targets/r/httr/client.js +0 -130
- package/dist/targets/r/target.d.ts +0 -2
- package/dist/targets/r/target.js +0 -15
- package/dist/targets/ruby/native/client.d.ts +0 -2
- package/dist/targets/ruby/native/client.js +0 -67
- package/dist/targets/ruby/target.d.ts +0 -2
- package/dist/targets/ruby/target.js +0 -15
- package/dist/targets/shell/curl/client.d.ts +0 -19
- package/dist/targets/shell/curl/client.js +0 -166
- package/dist/targets/shell/httpie/client.d.ts +0 -24
- package/dist/targets/shell/httpie/client.js +0 -102
- package/dist/targets/shell/target.d.ts +0 -2
- package/dist/targets/shell/target.js +0 -20
- package/dist/targets/shell/wget/client.d.ts +0 -16
- package/dist/targets/shell/wget/client.js +0 -46
- package/dist/targets/swift/helpers.d.ts +0 -16
- package/dist/targets/swift/helpers.js +0 -80
- package/dist/targets/swift/nsurlsession/client.d.ts +0 -15
- package/dist/targets/swift/nsurlsession/client.js +0 -148
- package/dist/targets/swift/target.d.ts +0 -2
- package/dist/targets/swift/target.js +0 -15
package/dist/helpers/utils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ClientInfo, TargetId, TargetInfo } from '../targets/targets';
|
|
2
|
-
export interface AvailableTarget extends TargetInfo {
|
|
3
|
-
clients: ClientInfo[];
|
|
4
|
-
}
|
|
5
|
-
export declare const availableTargets: () => AvailableTarget[];
|
|
6
|
-
export declare const extname: (targetId: TargetId) => "" | `.${string}`;
|
package/dist/helpers/utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.extname = exports.availableTargets = void 0;
|
|
15
|
-
var targets_1 = require("../targets/targets");
|
|
16
|
-
var availableTargets = function () {
|
|
17
|
-
return Object.keys(targets_1.targets).map(function (targetId) { return (__assign(__assign({}, targets_1.targets[targetId].info), { clients: Object.keys(targets_1.targets[targetId].clientsById).map(function (clientId) { return targets_1.targets[targetId].clientsById[clientId].info; }) })); });
|
|
18
|
-
};
|
|
19
|
-
exports.availableTargets = availableTargets;
|
|
20
|
-
var extname = function (targetId) { var _a; return ((_a = targets_1.targets[targetId]) === null || _a === void 0 ? void 0 : _a.info.extname) || ''; };
|
|
21
|
-
exports.extname = extname;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.libcurl = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var escape_1 = require("../../../helpers/escape");
|
|
6
|
-
exports.libcurl = {
|
|
7
|
-
info: {
|
|
8
|
-
key: 'libcurl',
|
|
9
|
-
title: 'Libcurl',
|
|
10
|
-
link: 'http://curl.haxx.se/libcurl',
|
|
11
|
-
description: 'Simple REST and HTTP API Client for C',
|
|
12
|
-
},
|
|
13
|
-
convert: function (_a) {
|
|
14
|
-
var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
|
|
15
|
-
var _b = new code_builder_1.CodeBuilder(), push = _b.push, blank = _b.blank, join = _b.join;
|
|
16
|
-
push('CURL *hnd = curl_easy_init();');
|
|
17
|
-
blank();
|
|
18
|
-
push("curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"".concat(method.toUpperCase(), "\");"));
|
|
19
|
-
push('curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);');
|
|
20
|
-
push("curl_easy_setopt(hnd, CURLOPT_URL, \"".concat(fullUrl, "\");"));
|
|
21
|
-
// Add headers, including the cookies
|
|
22
|
-
var headers = Object.keys(headersObj);
|
|
23
|
-
// construct headers
|
|
24
|
-
if (headers.length) {
|
|
25
|
-
blank();
|
|
26
|
-
push('struct curl_slist *headers = NULL;');
|
|
27
|
-
headers.forEach(function (header) {
|
|
28
|
-
push("headers = curl_slist_append(headers, \"".concat(header, ": ").concat((0, escape_1.escapeForDoubleQuotes)(headersObj[header]), "\");"));
|
|
29
|
-
});
|
|
30
|
-
push('curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);');
|
|
31
|
-
}
|
|
32
|
-
// construct cookies
|
|
33
|
-
if (allHeaders.cookie) {
|
|
34
|
-
blank();
|
|
35
|
-
push("curl_easy_setopt(hnd, CURLOPT_COOKIE, \"".concat(allHeaders.cookie, "\");"));
|
|
36
|
-
}
|
|
37
|
-
if (postData.text) {
|
|
38
|
-
blank();
|
|
39
|
-
push("curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ".concat(JSON.stringify(postData.text), ");"));
|
|
40
|
-
}
|
|
41
|
-
blank();
|
|
42
|
-
push('CURLcode ret = curl_easy_perform(hnd);');
|
|
43
|
-
return join();
|
|
44
|
-
},
|
|
45
|
-
};
|
package/dist/targets/c/target.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.c = void 0;
|
|
4
|
-
var client_1 = require("./libcurl/client");
|
|
5
|
-
exports.c = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'c',
|
|
8
|
-
title: 'C',
|
|
9
|
-
extname: '.c',
|
|
10
|
-
default: 'libcurl',
|
|
11
|
-
cli: 'c',
|
|
12
|
-
},
|
|
13
|
-
clientsById: {
|
|
14
|
-
libcurl: client_1.libcurl,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Clojure using clj-http.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @tggreene
|
|
7
|
-
*
|
|
8
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '../../targets';
|
|
11
|
-
export declare const clj_http: Client;
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clj_http = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var headers_1 = require("../../../helpers/headers");
|
|
6
|
-
var Keyword = /** @class */ (function () {
|
|
7
|
-
function Keyword(name) {
|
|
8
|
-
var _this = this;
|
|
9
|
-
this.name = '';
|
|
10
|
-
this.toString = function () { return ":".concat(_this.name); };
|
|
11
|
-
this.name = name;
|
|
12
|
-
}
|
|
13
|
-
return Keyword;
|
|
14
|
-
}());
|
|
15
|
-
var File = /** @class */ (function () {
|
|
16
|
-
function File(path) {
|
|
17
|
-
var _this = this;
|
|
18
|
-
this.path = '';
|
|
19
|
-
this.toString = function () { return "(clojure.java.io/file \"".concat(_this.path, "\")"); };
|
|
20
|
-
this.path = path;
|
|
21
|
-
}
|
|
22
|
-
return File;
|
|
23
|
-
}());
|
|
24
|
-
var jsType = function (input) {
|
|
25
|
-
if (input === undefined) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
if (input === null) {
|
|
29
|
-
return 'null';
|
|
30
|
-
}
|
|
31
|
-
return input.constructor.name.toLowerCase();
|
|
32
|
-
};
|
|
33
|
-
var objEmpty = function (input) {
|
|
34
|
-
if (input === undefined) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
else if (jsType(input) === 'object') {
|
|
38
|
-
return Object.keys(input).length === 0;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
};
|
|
42
|
-
var filterEmpty = function (input) {
|
|
43
|
-
Object.keys(input)
|
|
44
|
-
.filter(function (x) { return objEmpty(input[x]); })
|
|
45
|
-
.forEach(function (x) {
|
|
46
|
-
delete input[x];
|
|
47
|
-
});
|
|
48
|
-
return input;
|
|
49
|
-
};
|
|
50
|
-
var padBlock = function (padSize, input) {
|
|
51
|
-
var padding = ' '.repeat(padSize);
|
|
52
|
-
return input.replace(/\n/g, "\n".concat(padding));
|
|
53
|
-
};
|
|
54
|
-
var jsToEdn = function (js) {
|
|
55
|
-
switch (jsType(js)) {
|
|
56
|
-
case 'string':
|
|
57
|
-
return "\"".concat(js.replace(/"/g, '\\"'), "\"");
|
|
58
|
-
case 'file':
|
|
59
|
-
return js.toString();
|
|
60
|
-
case 'keyword':
|
|
61
|
-
return js.toString();
|
|
62
|
-
case 'null':
|
|
63
|
-
return 'nil';
|
|
64
|
-
case 'regexp':
|
|
65
|
-
return "#\"".concat(js.source, "\"");
|
|
66
|
-
case 'object': {
|
|
67
|
-
// simple vertical format
|
|
68
|
-
var obj = Object.keys(js)
|
|
69
|
-
.reduce(function (accumulator, key) {
|
|
70
|
-
var val = padBlock(key.length + 2, jsToEdn(js[key]));
|
|
71
|
-
return "".concat(accumulator, ":").concat(key, " ").concat(val, "\n ");
|
|
72
|
-
}, '')
|
|
73
|
-
.trim();
|
|
74
|
-
return "{".concat(padBlock(1, obj), "}");
|
|
75
|
-
}
|
|
76
|
-
case 'array': {
|
|
77
|
-
// simple horizontal format
|
|
78
|
-
var arr = js.reduce(function (accumulator, value) { return "".concat(accumulator, " ").concat(jsToEdn(value)); }, '').trim();
|
|
79
|
-
return "[".concat(padBlock(1, arr), "]");
|
|
80
|
-
}
|
|
81
|
-
default: // 'number' 'boolean'
|
|
82
|
-
return js.toString();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
exports.clj_http = {
|
|
86
|
-
info: {
|
|
87
|
-
key: 'clj_http',
|
|
88
|
-
title: 'clj-http',
|
|
89
|
-
link: 'https://github.com/dakrone/clj-http',
|
|
90
|
-
description: 'An idiomatic clojure http client wrapping the apache client.',
|
|
91
|
-
},
|
|
92
|
-
convert: function (_a, options) {
|
|
93
|
-
var queryObj = _a.queryObj, method = _a.method, postData = _a.postData, url = _a.url, allHeaders = _a.allHeaders;
|
|
94
|
-
var _b = new code_builder_1.CodeBuilder({ indent: options === null || options === void 0 ? void 0 : options.indent }), push = _b.push, join = _b.join;
|
|
95
|
-
var methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
|
|
96
|
-
method = method.toLowerCase();
|
|
97
|
-
if (!methods.includes(method)) {
|
|
98
|
-
push('Method not supported');
|
|
99
|
-
return join();
|
|
100
|
-
}
|
|
101
|
-
var params = {
|
|
102
|
-
headers: allHeaders,
|
|
103
|
-
'query-params': queryObj,
|
|
104
|
-
};
|
|
105
|
-
switch (postData.mimeType) {
|
|
106
|
-
case 'application/json':
|
|
107
|
-
{
|
|
108
|
-
params['content-type'] = new Keyword('json');
|
|
109
|
-
params['form-params'] = postData.jsonObj;
|
|
110
|
-
var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
|
|
111
|
-
if (header) {
|
|
112
|
-
delete params.headers[header];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
case 'application/x-www-form-urlencoded':
|
|
117
|
-
{
|
|
118
|
-
params['form-params'] = postData.paramsObj;
|
|
119
|
-
var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
|
|
120
|
-
if (header) {
|
|
121
|
-
delete params.headers[header];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
break;
|
|
125
|
-
case 'text/plain':
|
|
126
|
-
{
|
|
127
|
-
params.body = postData.text;
|
|
128
|
-
var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
|
|
129
|
-
if (header) {
|
|
130
|
-
delete params.headers[header];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
break;
|
|
134
|
-
case 'multipart/form-data': {
|
|
135
|
-
if (postData.params) {
|
|
136
|
-
params.multipart = postData.params.map(function (param) {
|
|
137
|
-
if (param.fileName && !param.value) {
|
|
138
|
-
return {
|
|
139
|
-
name: param.name,
|
|
140
|
-
content: new File(param.fileName),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
name: param.name,
|
|
145
|
-
content: param.value,
|
|
146
|
-
};
|
|
147
|
-
});
|
|
148
|
-
var header = (0, headers_1.getHeaderName)(params.headers, 'content-type');
|
|
149
|
-
if (header) {
|
|
150
|
-
delete params.headers[header];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
switch ((0, headers_1.getHeader)(params.headers, 'accept')) {
|
|
157
|
-
case 'application/json':
|
|
158
|
-
{
|
|
159
|
-
params.accept = new Keyword('json');
|
|
160
|
-
var header = (0, headers_1.getHeaderName)(params.headers, 'accept');
|
|
161
|
-
if (header) {
|
|
162
|
-
delete params.headers[header];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
push("(require '[clj-http.client :as client])\n");
|
|
168
|
-
if (objEmpty(filterEmpty(params))) {
|
|
169
|
-
push("(client/".concat(method, " \"").concat(url, "\")"));
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
var padding = 11 + method.length + url.length;
|
|
173
|
-
var formattedParams = padBlock(padding, jsToEdn(filterEmpty(params)));
|
|
174
|
-
push("(client/".concat(method, " \"").concat(url, "\" ").concat(formattedParams, ")"));
|
|
175
|
-
}
|
|
176
|
-
return join();
|
|
177
|
-
},
|
|
178
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clojure = void 0;
|
|
4
|
-
var client_1 = require("./clj_http/client");
|
|
5
|
-
exports.clojure = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'clojure',
|
|
8
|
-
title: 'Clojure',
|
|
9
|
-
extname: '.clj',
|
|
10
|
-
default: 'clj_http',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
clj_http: client_1.clj_http,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.httpclient = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
var headers_1 = require("../../../helpers/headers");
|
|
18
|
-
var getDecompressionMethods = function (allHeaders) {
|
|
19
|
-
var acceptEncodings = (0, headers_1.getHeader)(allHeaders, 'accept-encoding');
|
|
20
|
-
if (!acceptEncodings) {
|
|
21
|
-
return []; // no decompression
|
|
22
|
-
}
|
|
23
|
-
var supportedMethods = {
|
|
24
|
-
gzip: 'DecompressionMethods.GZip',
|
|
25
|
-
deflate: 'DecompressionMethods.Deflate',
|
|
26
|
-
};
|
|
27
|
-
var methods = [];
|
|
28
|
-
if (typeof acceptEncodings === 'string') {
|
|
29
|
-
acceptEncodings = [acceptEncodings];
|
|
30
|
-
}
|
|
31
|
-
acceptEncodings.forEach(function (acceptEncoding) {
|
|
32
|
-
acceptEncoding.split(',').forEach(function (encoding) {
|
|
33
|
-
var match = /\s*([^;\s]+)/.exec(encoding);
|
|
34
|
-
if (match) {
|
|
35
|
-
var method = supportedMethods[match[1]];
|
|
36
|
-
if (method) {
|
|
37
|
-
methods.push(method);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return methods;
|
|
43
|
-
};
|
|
44
|
-
exports.httpclient = {
|
|
45
|
-
info: {
|
|
46
|
-
key: 'httpclient',
|
|
47
|
-
title: 'HttpClient',
|
|
48
|
-
link: 'https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient',
|
|
49
|
-
description: '.NET Standard HTTP Client',
|
|
50
|
-
},
|
|
51
|
-
convert: function (_a, options) {
|
|
52
|
-
var _b, _c;
|
|
53
|
-
var allHeaders = _a.allHeaders, postData = _a.postData, method = _a.method, fullUrl = _a.fullUrl;
|
|
54
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
55
|
-
var _d = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _d.push, join = _d.join;
|
|
56
|
-
push('using System.Net.Http.Headers;');
|
|
57
|
-
var clienthandler = '';
|
|
58
|
-
var cookies = Boolean(allHeaders.cookie);
|
|
59
|
-
var decompressionMethods = getDecompressionMethods(allHeaders);
|
|
60
|
-
if (cookies || decompressionMethods.length) {
|
|
61
|
-
clienthandler = 'clientHandler';
|
|
62
|
-
push('var clientHandler = new HttpClientHandler');
|
|
63
|
-
push('{');
|
|
64
|
-
if (cookies) {
|
|
65
|
-
// enable setting the cookie header
|
|
66
|
-
push('UseCookies = false,', 1);
|
|
67
|
-
}
|
|
68
|
-
if (decompressionMethods.length) {
|
|
69
|
-
// enable decompression for supported methods
|
|
70
|
-
push("AutomaticDecompression = ".concat(decompressionMethods.join(' | '), ","), 1);
|
|
71
|
-
}
|
|
72
|
-
push('};');
|
|
73
|
-
}
|
|
74
|
-
push("var client = new HttpClient(".concat(clienthandler, ");"));
|
|
75
|
-
push('var request = new HttpRequestMessage');
|
|
76
|
-
push('{');
|
|
77
|
-
var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'TRACE'];
|
|
78
|
-
method = method.toUpperCase();
|
|
79
|
-
if (method && methods.includes(method)) {
|
|
80
|
-
// buildin method
|
|
81
|
-
method = "HttpMethod.".concat(method[0]).concat(method.substring(1).toLowerCase());
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// custom method
|
|
85
|
-
method = "new HttpMethod(\"".concat(method, "\")");
|
|
86
|
-
}
|
|
87
|
-
push("Method = ".concat(method, ","), 1);
|
|
88
|
-
push("RequestUri = new Uri(\"".concat(fullUrl, "\"),"), 1);
|
|
89
|
-
var headers = Object.keys(allHeaders).filter(function (header) {
|
|
90
|
-
switch (header.toLowerCase()) {
|
|
91
|
-
case 'content-type':
|
|
92
|
-
case 'content-length':
|
|
93
|
-
case 'accept-encoding':
|
|
94
|
-
// skip these headers
|
|
95
|
-
return false;
|
|
96
|
-
default:
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
if (headers.length) {
|
|
101
|
-
push('Headers =', 1);
|
|
102
|
-
push('{', 1);
|
|
103
|
-
headers.forEach(function (key) {
|
|
104
|
-
push("{ \"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\" },"), 2);
|
|
105
|
-
});
|
|
106
|
-
push('},', 1);
|
|
107
|
-
}
|
|
108
|
-
if (postData.text) {
|
|
109
|
-
var contentType = postData.mimeType;
|
|
110
|
-
switch (contentType) {
|
|
111
|
-
case 'application/x-www-form-urlencoded':
|
|
112
|
-
push('Content = new FormUrlEncodedContent(new Dictionary<string, string>', 1);
|
|
113
|
-
push('{', 1);
|
|
114
|
-
(_b = postData.params) === null || _b === void 0 ? void 0 : _b.forEach(function (param) {
|
|
115
|
-
push("{ \"".concat(param.name, "\", \"").concat(param.value, "\" },"), 2);
|
|
116
|
-
});
|
|
117
|
-
push('}),', 1);
|
|
118
|
-
break;
|
|
119
|
-
case 'multipart/form-data':
|
|
120
|
-
push('Content = new MultipartFormDataContent', 1);
|
|
121
|
-
push('{', 1);
|
|
122
|
-
(_c = postData.params) === null || _c === void 0 ? void 0 : _c.forEach(function (param) {
|
|
123
|
-
push("new StringContent(".concat(JSON.stringify(param.value || ''), ")"), 2);
|
|
124
|
-
push('{', 2);
|
|
125
|
-
push('Headers =', 3);
|
|
126
|
-
push('{', 3);
|
|
127
|
-
if (param.contentType) {
|
|
128
|
-
push("ContentType = new MediaTypeHeaderValue(\"".concat(param.contentType, "\"),"), 4);
|
|
129
|
-
}
|
|
130
|
-
push('ContentDisposition = new ContentDispositionHeaderValue("form-data")', 4);
|
|
131
|
-
push('{', 4);
|
|
132
|
-
push("Name = \"".concat(param.name, "\","), 5);
|
|
133
|
-
if (param.fileName) {
|
|
134
|
-
push("FileName = \"".concat(param.fileName, "\","), 5);
|
|
135
|
-
}
|
|
136
|
-
push('}', 4);
|
|
137
|
-
push('}', 3);
|
|
138
|
-
push('},', 2);
|
|
139
|
-
});
|
|
140
|
-
push('},', 1);
|
|
141
|
-
break;
|
|
142
|
-
default:
|
|
143
|
-
push("Content = new StringContent(".concat(JSON.stringify(postData.text || ''), ")"), 1);
|
|
144
|
-
push('{', 1);
|
|
145
|
-
push('Headers =', 2);
|
|
146
|
-
push('{', 2);
|
|
147
|
-
push("ContentType = new MediaTypeHeaderValue(\"".concat(contentType, "\")"), 3);
|
|
148
|
-
push('}', 2);
|
|
149
|
-
push('}', 1);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
push('};');
|
|
154
|
-
// send and read response
|
|
155
|
-
push('using (var response = await client.SendAsync(request))');
|
|
156
|
-
push('{');
|
|
157
|
-
push('response.EnsureSuccessStatusCode();', 1);
|
|
158
|
-
push('var body = await response.Content.ReadAsStringAsync();', 1);
|
|
159
|
-
push('Console.WriteLine(body);', 1);
|
|
160
|
-
push('}');
|
|
161
|
-
return join();
|
|
162
|
-
},
|
|
163
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.restsharp = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var escape_1 = require("../../../helpers/escape");
|
|
6
|
-
function title(s) {
|
|
7
|
-
return s[0].toUpperCase() + s.slice(1).toLowerCase();
|
|
8
|
-
}
|
|
9
|
-
exports.restsharp = {
|
|
10
|
-
info: {
|
|
11
|
-
key: 'restsharp',
|
|
12
|
-
title: 'RestSharp',
|
|
13
|
-
link: 'http://restsharp.org/',
|
|
14
|
-
description: 'Simple REST and HTTP API Client for .NET',
|
|
15
|
-
},
|
|
16
|
-
convert: function (_a) {
|
|
17
|
-
var method = _a.method, fullUrl = _a.fullUrl, headersObj = _a.headersObj, cookies = _a.cookies, postData = _a.postData, uriObj = _a.uriObj;
|
|
18
|
-
var _b = new code_builder_1.CodeBuilder(), push = _b.push, join = _b.join;
|
|
19
|
-
var isSupportedMethod = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'].includes(method.toUpperCase());
|
|
20
|
-
if (!isSupportedMethod) {
|
|
21
|
-
return 'Method not supported';
|
|
22
|
-
}
|
|
23
|
-
push('using RestSharp;\n\n');
|
|
24
|
-
push("var options = new RestClientOptions(\"".concat(fullUrl, "\");"));
|
|
25
|
-
push('var client = new RestClient(options);');
|
|
26
|
-
// The first argument is the sub-path to the base URL, given as the
|
|
27
|
-
// constructor to RestClient; for our purposes we're just giving the entire
|
|
28
|
-
// URL as the base path so it can be an empty string
|
|
29
|
-
push('var request = new RestRequest("");');
|
|
30
|
-
// If we have multipart form data, set this value. Setting the content-type header manually and then trying to add a mutlipart file parameter
|
|
31
|
-
var isMultipart = postData.mimeType && postData.mimeType === 'multipart/form-data';
|
|
32
|
-
if (isMultipart) {
|
|
33
|
-
push('request.AlwaysMultipartFormData = true;');
|
|
34
|
-
}
|
|
35
|
-
// Add headers, including the cookies
|
|
36
|
-
Object.keys(headersObj).forEach(function (key) {
|
|
37
|
-
// if we have post data, restsharp really wants to set the contentType
|
|
38
|
-
// itself; do not add a content-type header or you end up with failures
|
|
39
|
-
// which manifest as unhandled exceptions.
|
|
40
|
-
//
|
|
41
|
-
// The only case where we _do_ want to add it is if there's no postData
|
|
42
|
-
// text, in which case there will be no `AddJsonBody` call, and restsharp
|
|
43
|
-
// won't know to set the content type
|
|
44
|
-
if (postData.mimeType && key.toLowerCase() === 'content-type' && postData.text) {
|
|
45
|
-
if (isMultipart && postData.boundary) {
|
|
46
|
-
push("request.FormBoundary = \"".concat(postData.boundary, "\";"));
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
push("request.AddHeader(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(headersObj[key]), "\");"));
|
|
51
|
-
});
|
|
52
|
-
cookies.forEach(function (_a) {
|
|
53
|
-
var name = _a.name, value = _a.value;
|
|
54
|
-
push("request.AddCookie(\"".concat(name, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(value), "\", \"").concat(uriObj.pathname, "\", \"").concat(uriObj.host, "\");"));
|
|
55
|
-
});
|
|
56
|
-
switch (postData.mimeType) {
|
|
57
|
-
case 'multipart/form-data':
|
|
58
|
-
if (!postData.params)
|
|
59
|
-
break;
|
|
60
|
-
postData.params.forEach(function (param) {
|
|
61
|
-
if (param.fileName) {
|
|
62
|
-
push("request.AddFile(\"".concat(param.name, "\", \"").concat(param.fileName, "\");"));
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
push("request.AddParameter(\"".concat(param.name, "\", \"").concat(param.value, "\");"));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
break;
|
|
69
|
-
case 'application/x-www-form-urlencoded':
|
|
70
|
-
if (!postData.params)
|
|
71
|
-
break;
|
|
72
|
-
postData.params.forEach(function (param) {
|
|
73
|
-
push("request.AddParameter(\"".concat(param.name, "\", \"").concat(param.value, "\");"));
|
|
74
|
-
});
|
|
75
|
-
break;
|
|
76
|
-
case 'application/json': {
|
|
77
|
-
if (!postData.text)
|
|
78
|
-
break;
|
|
79
|
-
var text = JSON.stringify(postData.text);
|
|
80
|
-
push("request.AddJsonBody(".concat(text, ", false);"));
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
default:
|
|
84
|
-
if (!postData.text)
|
|
85
|
-
break;
|
|
86
|
-
push("request.AddStringBody(\"".concat(postData.text, "\", \"").concat(postData.mimeType, "\");"));
|
|
87
|
-
}
|
|
88
|
-
push("var response = await client.".concat(title(method), "Async(request);\n"));
|
|
89
|
-
push('Console.WriteLine("{0}", response.Content);\n');
|
|
90
|
-
return join();
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.csharp = void 0;
|
|
4
|
-
var client_1 = require("./httpclient/client");
|
|
5
|
-
var client_2 = require("./restsharp/client");
|
|
6
|
-
exports.csharp = {
|
|
7
|
-
info: {
|
|
8
|
-
key: 'csharp',
|
|
9
|
-
title: 'C#',
|
|
10
|
-
extname: '.cs',
|
|
11
|
-
default: 'restsharp',
|
|
12
|
-
cli: 'dotnet',
|
|
13
|
-
},
|
|
14
|
-
clientsById: {
|
|
15
|
-
httpclient: client_1.httpclient,
|
|
16
|
-
restsharp: client_2.restsharp,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for native Go.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @montanaflynn
|
|
7
|
-
*
|
|
8
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '../../targets';
|
|
11
|
-
export interface GoNativeOptions {
|
|
12
|
-
checkErrors?: boolean;
|
|
13
|
-
printBody?: boolean;
|
|
14
|
-
showBoilerplate?: boolean;
|
|
15
|
-
timeout?: number;
|
|
16
|
-
}
|
|
17
|
-
export declare const native: Client<GoNativeOptions>;
|