@readme/httpsnippet 6.2.1 → 7.0.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/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 +30 -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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ruby = void 0;
|
|
4
|
-
var client_1 = require("./native/client");
|
|
5
|
-
exports.ruby = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'ruby',
|
|
8
|
-
title: 'Ruby',
|
|
9
|
-
extname: '.rb',
|
|
10
|
-
default: 'native',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
native: client_1.native,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
*
|
|
4
|
-
* HTTP code snippet generator for the Shell using cURL.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
|
-
import type { Client } from '../../targets';
|
|
12
|
-
export interface CurlOptions {
|
|
13
|
-
binary?: boolean;
|
|
14
|
-
globOff?: boolean;
|
|
15
|
-
indent?: string | false;
|
|
16
|
-
prettifyJson?: boolean;
|
|
17
|
-
short?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const curl: Client<CurlOptions>;
|
|
@@ -1,166 +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.curl = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var headers_1 = require("../../../helpers/headers");
|
|
17
|
-
var shell_1 = require("../../../helpers/shell");
|
|
18
|
-
/**
|
|
19
|
-
* This is a const record with keys that correspond to the long names and values that correspond to the short names for cURL arguments.
|
|
20
|
-
*/
|
|
21
|
-
var params = {
|
|
22
|
-
'http1.0': '0',
|
|
23
|
-
'url ': '',
|
|
24
|
-
cookie: 'b',
|
|
25
|
-
data: 'd',
|
|
26
|
-
form: 'F',
|
|
27
|
-
globoff: 'g',
|
|
28
|
-
header: 'H',
|
|
29
|
-
insecure: 'k',
|
|
30
|
-
request: 'X',
|
|
31
|
-
};
|
|
32
|
-
var getArg = function (short) { return function (longName) {
|
|
33
|
-
if (short) {
|
|
34
|
-
var shortName = params[longName];
|
|
35
|
-
if (!shortName) {
|
|
36
|
-
return '';
|
|
37
|
-
}
|
|
38
|
-
return "-".concat(shortName);
|
|
39
|
-
}
|
|
40
|
-
return "--".concat(longName);
|
|
41
|
-
}; };
|
|
42
|
-
exports.curl = {
|
|
43
|
-
info: {
|
|
44
|
-
key: 'curl',
|
|
45
|
-
title: 'cURL',
|
|
46
|
-
link: 'http://curl.haxx.se/',
|
|
47
|
-
description: 'cURL is a command line tool and library for transferring data with URL syntax',
|
|
48
|
-
},
|
|
49
|
-
convert: function (_a, options) {
|
|
50
|
-
var _b;
|
|
51
|
-
var fullUrl = _a.fullUrl, method = _a.method, httpVersion = _a.httpVersion, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
|
|
52
|
-
if (options === void 0) { options = {}; }
|
|
53
|
-
var _c = options.indent, indent = _c === void 0 ? ' ' : _c, _d = options.short, short = _d === void 0 ? false : _d, _e = options.binary, binary = _e === void 0 ? false : _e, _f = options.globOff, globOff = _f === void 0 ? false : _f;
|
|
54
|
-
// In the interest of having nicer looking snippets JSON should be indented separately from the
|
|
55
|
-
// main command argument indentation.
|
|
56
|
-
var indentJSON = ' ';
|
|
57
|
-
var _g = new code_builder_1.CodeBuilder(__assign(__assign({}, (typeof indent === 'string' ? { indent: indent } : {})), { join: indent !== false ? " \\\n".concat(indent) : ' ' })), push = _g.push, join = _g.join;
|
|
58
|
-
var arg = getArg(short);
|
|
59
|
-
var formattedUrl = (0, shell_1.quote)(fullUrl);
|
|
60
|
-
push("curl ".concat(arg('request'), " ").concat(method));
|
|
61
|
-
if (globOff) {
|
|
62
|
-
formattedUrl = unescape(formattedUrl);
|
|
63
|
-
push(arg('globoff'));
|
|
64
|
-
}
|
|
65
|
-
push("".concat(arg('url ')).concat(formattedUrl));
|
|
66
|
-
if (httpVersion === 'HTTP/1.0') {
|
|
67
|
-
push(arg('http1.0'));
|
|
68
|
-
}
|
|
69
|
-
if ((0, headers_1.getHeader)(allHeaders, 'accept-encoding')) {
|
|
70
|
-
// note: there is no shorthand for this cURL option
|
|
71
|
-
push('--compressed');
|
|
72
|
-
}
|
|
73
|
-
// if multipart form data, we want to remove the boundary
|
|
74
|
-
if (postData.mimeType === 'multipart/form-data') {
|
|
75
|
-
var contentTypeHeaderName = (0, headers_1.getHeaderName)(headersObj, 'content-type');
|
|
76
|
-
if (contentTypeHeaderName) {
|
|
77
|
-
var contentTypeHeader = headersObj[contentTypeHeaderName];
|
|
78
|
-
if (contentTypeHeaderName && contentTypeHeader) {
|
|
79
|
-
// remove the leading semi colon and boundary
|
|
80
|
-
// up to the next semi colon or the end of string
|
|
81
|
-
var noBoundary = String(contentTypeHeader).replace(/; boundary.+?(?=(;|$))/, '');
|
|
82
|
-
// replace the content-type header with no boundary in both headersObj and allHeaders
|
|
83
|
-
headersObj[contentTypeHeaderName] = noBoundary;
|
|
84
|
-
allHeaders[contentTypeHeaderName] = noBoundary;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// construct headers
|
|
89
|
-
Object.keys(headersObj)
|
|
90
|
-
.sort()
|
|
91
|
-
.forEach(function (key) {
|
|
92
|
-
var header = "".concat(key, ": ").concat(headersObj[key]);
|
|
93
|
-
push("".concat(arg('header'), " ").concat((0, shell_1.quote)(header)));
|
|
94
|
-
});
|
|
95
|
-
if (allHeaders.cookie) {
|
|
96
|
-
push("".concat(arg('cookie'), " ").concat((0, shell_1.quote)(allHeaders.cookie)));
|
|
97
|
-
}
|
|
98
|
-
// construct post params
|
|
99
|
-
switch (postData.mimeType) {
|
|
100
|
-
case 'multipart/form-data':
|
|
101
|
-
(_b = postData.params) === null || _b === void 0 ? void 0 : _b.forEach(function (param) {
|
|
102
|
-
var post = '';
|
|
103
|
-
if (param.fileName) {
|
|
104
|
-
post = "".concat(param.name, "=@").concat(param.fileName);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
post = "".concat(param.name, "=").concat(param.value);
|
|
108
|
-
}
|
|
109
|
-
push("".concat(arg('form'), " ").concat((0, shell_1.quote)(post)));
|
|
110
|
-
});
|
|
111
|
-
break;
|
|
112
|
-
case 'application/x-www-form-urlencoded':
|
|
113
|
-
if (postData.params) {
|
|
114
|
-
postData.params.forEach(function (param) {
|
|
115
|
-
var unencoded = param.name;
|
|
116
|
-
var encoded = encodeURIComponent(param.name);
|
|
117
|
-
var needsEncoding = encoded !== unencoded;
|
|
118
|
-
var name = needsEncoding ? encoded : unencoded;
|
|
119
|
-
var flag = binary ? '--data-binary' : "--data".concat(needsEncoding ? '-urlencode' : '');
|
|
120
|
-
push("".concat(flag, " ").concat((0, shell_1.quote)("".concat(name, "=").concat(param.value))));
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
push("".concat(binary ? '--data-binary' : arg('data'), " ").concat((0, shell_1.quote)(postData.text)));
|
|
125
|
-
}
|
|
126
|
-
break;
|
|
127
|
-
default:
|
|
128
|
-
// raw request body
|
|
129
|
-
if (!postData.text) {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
// eslint-disable-next-line no-case-declarations -- builtPayload is only used here.
|
|
133
|
-
var builtPayload = false;
|
|
134
|
-
// If we're dealing with a JSON variant, and our payload is JSON let's make it look a little
|
|
135
|
-
// nicer.
|
|
136
|
-
if ((0, headers_1.isMimeTypeJSON)(postData.mimeType)) {
|
|
137
|
-
// If our postData is less than 20 characters, let's keep it all on one line so as to not
|
|
138
|
-
// make the snippet overly lengthy
|
|
139
|
-
if (postData.text.length > 20) {
|
|
140
|
-
try {
|
|
141
|
-
var jsonPayload = JSON.parse(postData.text);
|
|
142
|
-
// If the JSON object has a single quote we should prepare it inside of a HEREDOC
|
|
143
|
-
// because the single quote in something like `string's` can't be escaped when used
|
|
144
|
-
// with `--data`.
|
|
145
|
-
//
|
|
146
|
-
// Basically this boils down to `--data @- <<EOF...EOF` vs `--data '...'`.
|
|
147
|
-
builtPayload = true;
|
|
148
|
-
if (postData.text.indexOf("'") > 0) {
|
|
149
|
-
push("".concat(binary ? '--data-binary' : arg('data'), " @- <<EOF\n").concat(JSON.stringify(jsonPayload, null, indentJSON), "\nEOF"));
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
push("".concat(binary ? '--data-binary' : arg('data'), " '\n").concat(JSON.stringify(jsonPayload, null, indentJSON), "\n'"));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch (err) {
|
|
156
|
-
// no-op
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (!builtPayload) {
|
|
161
|
-
push("".concat(binary ? '--data-binary' : arg('data'), " ").concat((0, shell_1.quote)(postData.text)));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return join();
|
|
165
|
-
},
|
|
166
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for the Shell using HTTPie.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @AhmadNassri
|
|
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 HttpieOptions {
|
|
12
|
-
body?: boolean;
|
|
13
|
-
cert?: boolean;
|
|
14
|
-
headers?: boolean;
|
|
15
|
-
pretty?: boolean;
|
|
16
|
-
print?: boolean;
|
|
17
|
-
queryParams?: boolean;
|
|
18
|
-
short?: boolean;
|
|
19
|
-
style?: boolean;
|
|
20
|
-
timeout?: boolean;
|
|
21
|
-
verbose?: boolean;
|
|
22
|
-
verify?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare const httpie: Client<HttpieOptions>;
|
|
@@ -1,102 +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.httpie = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var shell_1 = require("../../../helpers/shell");
|
|
17
|
-
exports.httpie = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'httpie',
|
|
20
|
-
title: 'HTTPie',
|
|
21
|
-
link: 'http://httpie.org/',
|
|
22
|
-
description: 'a CLI, cURL-like tool for humans',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var allHeaders = _a.allHeaders, postData = _a.postData, queryObj = _a.queryObj, fullUrl = _a.fullUrl, method = _a.method, url = _a.url;
|
|
26
|
-
var opts = __assign({ body: false, cert: false, headers: false, indent: ' ', pretty: false, print: false, queryParams: false, short: false, style: false, timeout: false, verbose: false, verify: false }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({
|
|
28
|
-
indent: opts.indent,
|
|
29
|
-
// @ts-expect-error SEEMS LEGIT
|
|
30
|
-
join: opts.indent !== false ? " \\\n".concat(opts.indent) : ' ',
|
|
31
|
-
}), push = _b.push, join = _b.join, unshift = _b.unshift;
|
|
32
|
-
var raw = false;
|
|
33
|
-
var flags = [];
|
|
34
|
-
if (opts.headers) {
|
|
35
|
-
flags.push(opts.short ? '-h' : '--headers');
|
|
36
|
-
}
|
|
37
|
-
if (opts.body) {
|
|
38
|
-
flags.push(opts.short ? '-b' : '--body');
|
|
39
|
-
}
|
|
40
|
-
if (opts.verbose) {
|
|
41
|
-
flags.push(opts.short ? '-v' : '--verbose');
|
|
42
|
-
}
|
|
43
|
-
if (opts.print) {
|
|
44
|
-
flags.push("".concat(opts.short ? '-p' : '--print', "=").concat(opts.print));
|
|
45
|
-
}
|
|
46
|
-
if (opts.verify) {
|
|
47
|
-
flags.push("--verify=".concat(opts.verify));
|
|
48
|
-
}
|
|
49
|
-
if (opts.cert) {
|
|
50
|
-
flags.push("--cert=".concat(opts.cert));
|
|
51
|
-
}
|
|
52
|
-
if (opts.pretty) {
|
|
53
|
-
flags.push("--pretty=".concat(opts.pretty));
|
|
54
|
-
}
|
|
55
|
-
if (opts.style) {
|
|
56
|
-
flags.push("--style=".concat(opts.style));
|
|
57
|
-
}
|
|
58
|
-
if (opts.timeout) {
|
|
59
|
-
flags.push("--timeout=".concat(opts.timeout));
|
|
60
|
-
}
|
|
61
|
-
// construct query params
|
|
62
|
-
if (opts.queryParams) {
|
|
63
|
-
Object.keys(queryObj).forEach(function (name) {
|
|
64
|
-
var value = queryObj[name];
|
|
65
|
-
if (Array.isArray(value)) {
|
|
66
|
-
value.forEach(function (val) {
|
|
67
|
-
push("".concat(name, "==").concat((0, shell_1.quote)(val)));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
push("".concat(name, "==").concat((0, shell_1.quote)(value)));
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
// construct headers
|
|
76
|
-
Object.keys(allHeaders)
|
|
77
|
-
.sort()
|
|
78
|
-
.forEach(function (key) {
|
|
79
|
-
push("".concat(key, ":").concat((0, shell_1.quote)(allHeaders[key])));
|
|
80
|
-
});
|
|
81
|
-
if (postData.mimeType === 'application/x-www-form-urlencoded') {
|
|
82
|
-
// construct post params
|
|
83
|
-
if (postData.params && postData.params.length) {
|
|
84
|
-
flags.push(opts.short ? '-f' : '--form');
|
|
85
|
-
postData.params.forEach(function (param) {
|
|
86
|
-
push("".concat(param.name, "=").concat((0, shell_1.quote)(param.value)));
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
raw = true;
|
|
92
|
-
}
|
|
93
|
-
var cliFlags = flags.length ? "".concat(flags.join(' '), " ") : '';
|
|
94
|
-
url = (0, shell_1.quote)(opts.queryParams ? url : fullUrl);
|
|
95
|
-
unshift("http ".concat(cliFlags).concat(method, " ").concat(url));
|
|
96
|
-
if (raw && postData.text) {
|
|
97
|
-
var postDataText = (0, shell_1.quote)(postData.text);
|
|
98
|
-
unshift("echo ".concat(postDataText, " | "));
|
|
99
|
-
}
|
|
100
|
-
return join();
|
|
101
|
-
},
|
|
102
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shell = void 0;
|
|
4
|
-
var client_1 = require("./curl/client");
|
|
5
|
-
var client_2 = require("./httpie/client");
|
|
6
|
-
var client_3 = require("./wget/client");
|
|
7
|
-
exports.shell = {
|
|
8
|
-
info: {
|
|
9
|
-
key: 'shell',
|
|
10
|
-
title: 'Shell',
|
|
11
|
-
extname: '.sh',
|
|
12
|
-
default: 'curl',
|
|
13
|
-
cli: '%s',
|
|
14
|
-
},
|
|
15
|
-
clientsById: {
|
|
16
|
-
curl: client_1.curl,
|
|
17
|
-
httpie: client_2.httpie,
|
|
18
|
-
wget: client_3.wget,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for the Shell using Wget.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @AhmadNassri
|
|
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 WgetOptions {
|
|
12
|
-
indent?: string | false;
|
|
13
|
-
short?: boolean;
|
|
14
|
-
verbose?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare const wget: Client<WgetOptions>;
|
|
@@ -1,46 +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.wget = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var shell_1 = require("../../../helpers/shell");
|
|
17
|
-
exports.wget = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'wget',
|
|
20
|
-
title: 'Wget',
|
|
21
|
-
link: 'https://www.gnu.org/software/wget/',
|
|
22
|
-
description: 'a free software package for retrieving files using HTTP, HTTPS',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var method = _a.method, postData = _a.postData, allHeaders = _a.allHeaders, fullUrl = _a.fullUrl;
|
|
26
|
-
var opts = __assign({ indent: ' ', short: false, verbose: false }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder(__assign(__assign({}, (typeof opts.indent === 'string' ? { indent: opts.indent } : {})), { join: opts.indent !== false ? " \\\n".concat(opts.indent) : ' ' })), push = _b.push, join = _b.join;
|
|
28
|
-
if (opts.verbose) {
|
|
29
|
-
push("wget ".concat(opts.short ? '-v' : '--verbose'));
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
push("wget ".concat(opts.short ? '-q' : '--quiet'));
|
|
33
|
-
}
|
|
34
|
-
push("--method ".concat((0, shell_1.quote)(method)));
|
|
35
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
36
|
-
var header = "".concat(key, ": ").concat(allHeaders[key]);
|
|
37
|
-
push("--header ".concat((0, shell_1.quote)(header)));
|
|
38
|
-
});
|
|
39
|
-
if (postData.text) {
|
|
40
|
-
push("--body-data ".concat((0, shell_1.escape)((0, shell_1.quote)(postData.text))));
|
|
41
|
-
}
|
|
42
|
-
push(opts.short ? '-O' : '--output-document');
|
|
43
|
-
push("- ".concat((0, shell_1.quote)(fullUrl)));
|
|
44
|
-
return join();
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a string corresponding to a valid declaration and initialization of a Swift array or dictionary literal
|
|
3
|
-
*
|
|
4
|
-
* @param name Desired name of the instance
|
|
5
|
-
* @param parameters Key-value object of parameters to translate to a Swift object litearal
|
|
6
|
-
* @param opts Target options
|
|
7
|
-
* @return {string}
|
|
8
|
-
*/
|
|
9
|
-
export declare const literalDeclaration: <T, U>(name: string, parameters: T, opts: U) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Create a valid Swift string of a literal value according to its type.
|
|
12
|
-
*
|
|
13
|
-
* @param value Any JavaScript literal
|
|
14
|
-
* @param opts Target options
|
|
15
|
-
*/
|
|
16
|
-
export declare const literalRepresentation: <T, U>(value: T, opts: U, indentLevel?: number) => number | string;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.literalRepresentation = exports.literalDeclaration = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Create an string of given length filled with blank spaces
|
|
6
|
-
*
|
|
7
|
-
* @param length Length of the array to return
|
|
8
|
-
* @param str String to pad out with
|
|
9
|
-
*/
|
|
10
|
-
var buildString = function (length, str) { return str.repeat(length); };
|
|
11
|
-
/**
|
|
12
|
-
* Create a string corresponding to a Dictionary or Array literal representation with pretty option and indentation.
|
|
13
|
-
*/
|
|
14
|
-
var concatArray = function (arr, pretty, indentation, indentLevel) {
|
|
15
|
-
var currentIndent = buildString(indentLevel, indentation);
|
|
16
|
-
var closingBraceIndent = buildString(indentLevel - 1, indentation);
|
|
17
|
-
var join = pretty ? ",\n".concat(currentIndent) : ', ';
|
|
18
|
-
if (pretty) {
|
|
19
|
-
return "[\n".concat(currentIndent).concat(arr.join(join), "\n").concat(closingBraceIndent, "]");
|
|
20
|
-
}
|
|
21
|
-
return "[".concat(arr.join(join), "]");
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Create a string corresponding to a valid declaration and initialization of a Swift array or dictionary literal
|
|
25
|
-
*
|
|
26
|
-
* @param name Desired name of the instance
|
|
27
|
-
* @param parameters Key-value object of parameters to translate to a Swift object litearal
|
|
28
|
-
* @param opts Target options
|
|
29
|
-
* @return {string}
|
|
30
|
-
*/
|
|
31
|
-
var literalDeclaration = function (name, parameters, opts) {
|
|
32
|
-
return "let ".concat(name, " = ").concat((0, exports.literalRepresentation)(parameters, opts));
|
|
33
|
-
};
|
|
34
|
-
exports.literalDeclaration = literalDeclaration;
|
|
35
|
-
/**
|
|
36
|
-
* Create a valid Swift string of a literal value according to its type.
|
|
37
|
-
*
|
|
38
|
-
* @param value Any JavaScript literal
|
|
39
|
-
* @param opts Target options
|
|
40
|
-
*/
|
|
41
|
-
var literalRepresentation = function (value, opts, indentLevel) {
|
|
42
|
-
indentLevel = indentLevel === undefined ? 1 : indentLevel + 1;
|
|
43
|
-
switch (Object.prototype.toString.call(value)) {
|
|
44
|
-
case '[object Number]':
|
|
45
|
-
return value;
|
|
46
|
-
case '[object Array]': {
|
|
47
|
-
// Don't prettify arrays nto not take too much space
|
|
48
|
-
var pretty_1 = false;
|
|
49
|
-
var valuesRepresentation = value.map(function (v) {
|
|
50
|
-
// Switch to prettify if the value is a dictionary with multiple keys
|
|
51
|
-
if (Object.prototype.toString.call(v) === '[object Object]') {
|
|
52
|
-
pretty_1 = Object.keys(v).length > 1;
|
|
53
|
-
}
|
|
54
|
-
return (0, exports.literalRepresentation)(v, opts, indentLevel);
|
|
55
|
-
});
|
|
56
|
-
// @ts-expect-error needs better types
|
|
57
|
-
return concatArray(valuesRepresentation, pretty_1, opts.indent, indentLevel);
|
|
58
|
-
}
|
|
59
|
-
case '[object Object]': {
|
|
60
|
-
var keyValuePairs = [];
|
|
61
|
-
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
62
|
-
for (var key in value) {
|
|
63
|
-
keyValuePairs.push("\"".concat(key, "\": ").concat((0, exports.literalRepresentation)(value[key], opts, indentLevel)));
|
|
64
|
-
}
|
|
65
|
-
return concatArray(keyValuePairs,
|
|
66
|
-
// @ts-expect-error needs better types
|
|
67
|
-
opts.pretty && keyValuePairs.length > 1,
|
|
68
|
-
// @ts-expect-error needs better types
|
|
69
|
-
opts.indent, indentLevel);
|
|
70
|
-
}
|
|
71
|
-
case '[object Boolean]':
|
|
72
|
-
return value.toString();
|
|
73
|
-
default:
|
|
74
|
-
if (value === null || value === undefined) {
|
|
75
|
-
return '';
|
|
76
|
-
}
|
|
77
|
-
return "\"".concat(value.toString().replace(/"/g, '\\"'), "\"");
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
exports.literalRepresentation = literalRepresentation;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Swift using NSURLSession.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @thibaultCha
|
|
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 NsurlsessionOptions {
|
|
12
|
-
pretty?: boolean;
|
|
13
|
-
timeout?: number | string;
|
|
14
|
-
}
|
|
15
|
-
export declare const nsurlsession: Client<NsurlsessionOptions>;
|