@readme/httpsnippet 6.2.0 → 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,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var data = null;
|
|
3
|
-
var xhr = new XMLHttpRequest();
|
|
4
|
-
xhr.withCredentials = true;
|
|
5
|
-
xhr.addEventListener('readystatechange', function () {
|
|
6
|
-
if (this.readyState === this.DONE) {
|
|
7
|
-
console.log(this.responseText);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
xhr.open('POST', 'https://httpbin.org/anything');
|
|
11
|
-
xhr.setRequestHeader('content-type', 'application/json');
|
|
12
|
-
xhr.send(data);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var data = null;
|
|
3
|
-
var xhr = new XMLHttpRequest();
|
|
4
|
-
xhr.withCredentials = true;
|
|
5
|
-
xhr.addEventListener('readystatechange', function () {
|
|
6
|
-
if (this.readyState === this.DONE) {
|
|
7
|
-
console.log(this.responseText);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
xhr.open('GET', 'https://httpbin.org/anything?startTime=2019-06-13T19%3A08%3A25.455Z&endTime=2015-09-15T14%3A00%3A12-04%3A00');
|
|
11
|
-
xhr.send(data);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var data = null;
|
|
3
|
-
var xhr = new XMLHttpRequest();
|
|
4
|
-
xhr.withCredentials = true;
|
|
5
|
-
xhr.addEventListener('readystatechange', function () {
|
|
6
|
-
if (this.readyState === this.DONE) {
|
|
7
|
-
console.log(this.responseText);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
xhr.open('GET', 'https://httpbin.org/anything?foo=bar&foo=baz&baz=abc&key=value');
|
|
11
|
-
xhr.send(data);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var data = null;
|
|
3
|
-
var xhr = new XMLHttpRequest();
|
|
4
|
-
xhr.withCredentials = true;
|
|
5
|
-
xhr.addEventListener('readystatechange', function () {
|
|
6
|
-
if (this.readyState === this.DONE) {
|
|
7
|
-
console.log(this.responseText);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
xhr.open('GET', 'https://httpbin.org/anything');
|
|
11
|
-
xhr.send(data);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var data = 'Hello World';
|
|
3
|
-
var xhr = new XMLHttpRequest();
|
|
4
|
-
xhr.withCredentials = true;
|
|
5
|
-
xhr.addEventListener('readystatechange', function () {
|
|
6
|
-
if (this.readyState === this.DONE) {
|
|
7
|
-
console.log(this.responseText);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
xhr.open('POST', 'https://httpbin.org/anything');
|
|
11
|
-
xhr.setRequestHeader('content-type', 'text/plain');
|
|
12
|
-
xhr.send(data);
|
|
@@ -1,56 +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.native = void 0;
|
|
15
|
-
exports.native = {
|
|
16
|
-
info: {
|
|
17
|
-
key: 'native',
|
|
18
|
-
title: 'Native JSON',
|
|
19
|
-
link: 'https://www.json.org/json-en.html',
|
|
20
|
-
description: 'A JSON represetation of any HAR payload.',
|
|
21
|
-
},
|
|
22
|
-
convert: function (_a, inputOpts) {
|
|
23
|
-
var postData = _a.postData;
|
|
24
|
-
var opts = __assign({ indent: ' ' }, inputOpts);
|
|
25
|
-
var payload = '';
|
|
26
|
-
switch (postData.mimeType) {
|
|
27
|
-
case 'application/x-www-form-urlencoded':
|
|
28
|
-
payload = postData.paramsObj ? postData.paramsObj : postData.text;
|
|
29
|
-
break;
|
|
30
|
-
case 'application/json':
|
|
31
|
-
if (postData.jsonObj) {
|
|
32
|
-
payload = postData.jsonObj;
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
case 'multipart/form-data':
|
|
36
|
-
if (!postData.params) {
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
// eslint-disable-next-line no-case-declarations
|
|
40
|
-
var multipartPayload_1 = {};
|
|
41
|
-
postData.params.forEach(function (param) {
|
|
42
|
-
multipartPayload_1[param.name] = param.value;
|
|
43
|
-
});
|
|
44
|
-
payload = multipartPayload_1;
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
if (postData.text) {
|
|
48
|
-
payload = postData.text;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (typeof payload === undefined || payload === '') {
|
|
52
|
-
return '';
|
|
53
|
-
}
|
|
54
|
-
return JSON.stringify(payload, null, opts.indent);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.json = void 0;
|
|
4
|
-
var client_1 = require("./native/client");
|
|
5
|
-
exports.json = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'json',
|
|
8
|
-
title: 'JSON',
|
|
9
|
-
extname: '.json',
|
|
10
|
-
default: 'native',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
native: client_1.native,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Kotlin using OkHttp.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @seanghay
|
|
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 okhttp: Client;
|
|
@@ -1,71 +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.okhttp = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
exports.okhttp = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'okhttp',
|
|
20
|
-
title: 'OkHttp',
|
|
21
|
-
link: 'http://square.github.io/okhttp/',
|
|
22
|
-
description: 'An HTTP Request Client Library',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method, allHeaders = _a.allHeaders;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), blank = _b.blank, join = _b.join, push = _b.push;
|
|
28
|
-
var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
29
|
-
var methodsWithBody = ['POST', 'PUT', 'DELETE', 'PATCH'];
|
|
30
|
-
push('val client = OkHttpClient()');
|
|
31
|
-
blank();
|
|
32
|
-
if (postData.text) {
|
|
33
|
-
if (postData.boundary) {
|
|
34
|
-
push("val mediaType = MediaType.parse(\"".concat(postData.mimeType, "; boundary=").concat(postData.boundary, "\")"));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
push("val mediaType = MediaType.parse(\"".concat(postData.mimeType, "\")"));
|
|
38
|
-
}
|
|
39
|
-
push("val body = RequestBody.create(mediaType, ".concat(JSON.stringify(postData.text), ")"));
|
|
40
|
-
}
|
|
41
|
-
push('val request = Request.Builder()');
|
|
42
|
-
push(".url(\"".concat(fullUrl, "\")"), 1);
|
|
43
|
-
if (!methods.includes(method.toUpperCase())) {
|
|
44
|
-
if (postData.text) {
|
|
45
|
-
push(".method(\"".concat(method.toUpperCase(), "\", body)"), 1);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
push(".method(\"".concat(method.toUpperCase(), "\", null)"), 1);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (methodsWithBody.includes(method.toUpperCase())) {
|
|
52
|
-
if (postData.text) {
|
|
53
|
-
push(".".concat(method.toLowerCase(), "(body)"), 1);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
push(".".concat(method.toLowerCase(), "(null)"), 1);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
push(".".concat(method.toLowerCase(), "()"), 1);
|
|
61
|
-
}
|
|
62
|
-
// Add headers, including the cookies
|
|
63
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
64
|
-
push(".addHeader(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\")"), 1);
|
|
65
|
-
});
|
|
66
|
-
push('.build()', 1);
|
|
67
|
-
blank();
|
|
68
|
-
push('val response = client.newCall(request).execute()');
|
|
69
|
-
return join();
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kotlin = void 0;
|
|
4
|
-
var client_1 = require("./okhttp/client");
|
|
5
|
-
exports.kotlin = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'kotlin',
|
|
8
|
-
title: 'Kotlin',
|
|
9
|
-
extname: '.kt',
|
|
10
|
-
default: 'okhttp',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
okhttp: client_1.okhttp,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Javascript & Node.js using Axios.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @rohit-gohri
|
|
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 axios: Client;
|
|
@@ -1,78 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.axios = void 0;
|
|
18
|
-
var stringify_object_1 = __importDefault(require("stringify-object"));
|
|
19
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
20
|
-
exports.axios = {
|
|
21
|
-
info: {
|
|
22
|
-
key: 'axios',
|
|
23
|
-
title: 'Axios',
|
|
24
|
-
link: 'https://github.com/axios/axios',
|
|
25
|
-
description: 'Promise based HTTP client for the browser and node.js',
|
|
26
|
-
},
|
|
27
|
-
convert: function (_a, options) {
|
|
28
|
-
var method = _a.method, fullUrl = _a.fullUrl, allHeaders = _a.allHeaders, postData = _a.postData;
|
|
29
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
30
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), blank = _b.blank, join = _b.join, push = _b.push, addPostProcessor = _b.addPostProcessor;
|
|
31
|
-
push("const axios = require('axios');");
|
|
32
|
-
var reqOpts = {
|
|
33
|
-
method: method,
|
|
34
|
-
url: fullUrl,
|
|
35
|
-
};
|
|
36
|
-
if (Object.keys(allHeaders).length) {
|
|
37
|
-
reqOpts.headers = allHeaders;
|
|
38
|
-
}
|
|
39
|
-
switch (postData.mimeType) {
|
|
40
|
-
case 'application/x-www-form-urlencoded':
|
|
41
|
-
if (postData.params) {
|
|
42
|
-
push("const { URLSearchParams } = require('url');");
|
|
43
|
-
blank();
|
|
44
|
-
push('const encodedParams = new URLSearchParams();');
|
|
45
|
-
postData.params.forEach(function (param) {
|
|
46
|
-
push("encodedParams.set('".concat(param.name, "', '").concat(param.value, "');"));
|
|
47
|
-
});
|
|
48
|
-
blank();
|
|
49
|
-
reqOpts.data = 'encodedParams,';
|
|
50
|
-
addPostProcessor(function (code) { return code.replace(/'encodedParams,'/, 'encodedParams,'); });
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
case 'application/json':
|
|
54
|
-
blank();
|
|
55
|
-
if (postData.jsonObj) {
|
|
56
|
-
reqOpts.data = postData.jsonObj;
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
default:
|
|
60
|
-
blank();
|
|
61
|
-
if (postData.text) {
|
|
62
|
-
reqOpts.data = postData.text;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
var stringifiedOptions = (0, stringify_object_1.default)(reqOpts, { indent: ' ', inlineCharacterLimit: 80 });
|
|
66
|
-
push("const options = ".concat(stringifiedOptions, ";"));
|
|
67
|
-
blank();
|
|
68
|
-
push('axios');
|
|
69
|
-
push('.request(options)', 1);
|
|
70
|
-
push('.then(function (response) {', 1);
|
|
71
|
-
push('console.log(response.data);', 2);
|
|
72
|
-
push('})', 1);
|
|
73
|
-
push('.catch(function (error) {', 1);
|
|
74
|
-
push('console.error(error);', 2);
|
|
75
|
-
push('});', 1);
|
|
76
|
-
return join();
|
|
77
|
-
},
|
|
78
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var URLSearchParams = require('url').URLSearchParams;
|
|
4
|
-
var encodedParams = new URLSearchParams();
|
|
5
|
-
encodedParams.set('foo', 'bar');
|
|
6
|
-
encodedParams.set('hello', 'world');
|
|
7
|
-
var options = {
|
|
8
|
-
method: 'POST',
|
|
9
|
-
url: 'https://httpbin.org/anything',
|
|
10
|
-
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
11
|
-
data: encodedParams,
|
|
12
|
-
};
|
|
13
|
-
axios
|
|
14
|
-
.request(options)
|
|
15
|
-
.then(function (response) {
|
|
16
|
-
console.log(response.data);
|
|
17
|
-
})
|
|
18
|
-
.catch(function (error) {
|
|
19
|
-
console.error(error);
|
|
20
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'content-type': 'application/json' },
|
|
7
|
-
data: {
|
|
8
|
-
number: 1,
|
|
9
|
-
string: 'f"oo',
|
|
10
|
-
arr: [1, 2, 3],
|
|
11
|
-
nested: { a: 'b' },
|
|
12
|
-
arr_mix: [1, 'a', { arr_mix_nested: [] }],
|
|
13
|
-
boolean: false
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
axios
|
|
17
|
-
.request(options)
|
|
18
|
-
.then(function (response) {
|
|
19
|
-
console.log(response.data);
|
|
20
|
-
})
|
|
21
|
-
.catch(function (error) {
|
|
22
|
-
console.error(error);
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'GET',
|
|
5
|
-
url: 'https://httpbin.org/cookies',
|
|
6
|
-
headers: { cookie: 'foo=bar; bar=baz' }
|
|
7
|
-
};
|
|
8
|
-
axios
|
|
9
|
-
.request(options)
|
|
10
|
-
.then(function (response) {
|
|
11
|
-
console.log(response.data);
|
|
12
|
-
})
|
|
13
|
-
.catch(function (error) {
|
|
14
|
-
console.error(error);
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = { method: 'PROPFIND', url: 'https://httpbin.org/anything' };
|
|
4
|
-
axios
|
|
5
|
-
.request(options)
|
|
6
|
-
.then(function (response) {
|
|
7
|
-
console.log(response.data);
|
|
8
|
-
})
|
|
9
|
-
.catch(function (error) {
|
|
10
|
-
console.error(error);
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var URLSearchParams = require('url').URLSearchParams;
|
|
4
|
-
var encodedParams = new URLSearchParams();
|
|
5
|
-
encodedParams.set('foo', 'bar');
|
|
6
|
-
var options = {
|
|
7
|
-
method: 'POST',
|
|
8
|
-
url: 'https://httpbin.org/anything?foo=bar&foo=baz&baz=abc&key=value',
|
|
9
|
-
headers: {
|
|
10
|
-
cookie: 'foo=bar; bar=baz',
|
|
11
|
-
accept: 'application/json',
|
|
12
|
-
'content-type': 'application/x-www-form-urlencoded'
|
|
13
|
-
},
|
|
14
|
-
data: encodedParams,
|
|
15
|
-
};
|
|
16
|
-
axios
|
|
17
|
-
.request(options)
|
|
18
|
-
.then(function (response) {
|
|
19
|
-
console.log(response.data);
|
|
20
|
-
})
|
|
21
|
-
.catch(function (error) {
|
|
22
|
-
console.error(error);
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'GET',
|
|
5
|
-
url: 'https://httpbin.org/headers',
|
|
6
|
-
headers: {
|
|
7
|
-
accept: 'application/json',
|
|
8
|
-
'x-foo': 'Bar',
|
|
9
|
-
'x-bar': 'Foo',
|
|
10
|
-
'quoted-value': '"quoted" \'string\''
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
axios
|
|
14
|
-
.request(options)
|
|
15
|
-
.then(function (response) {
|
|
16
|
-
console.log(response.data);
|
|
17
|
-
})
|
|
18
|
-
.catch(function (error) {
|
|
19
|
-
console.error(error);
|
|
20
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = { method: 'GET', url: 'http://httpbin.org/anything' };
|
|
4
|
-
axios
|
|
5
|
-
.request(options)
|
|
6
|
-
.then(function (response) {
|
|
7
|
-
console.log(response.data);
|
|
8
|
-
})
|
|
9
|
-
.catch(function (error) {
|
|
10
|
-
console.error(error);
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'content-type': 'application/json' },
|
|
7
|
-
data: { foo: 'bar' }
|
|
8
|
-
};
|
|
9
|
-
axios
|
|
10
|
-
.request(options)
|
|
11
|
-
.then(function (response) {
|
|
12
|
-
console.log(response.data);
|
|
13
|
-
})
|
|
14
|
-
.catch(function (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'content-type': 'application/json' },
|
|
7
|
-
data: { foo: null }
|
|
8
|
-
};
|
|
9
|
-
axios
|
|
10
|
-
.request(options)
|
|
11
|
-
.then(function (response) {
|
|
12
|
-
console.log(response.data);
|
|
13
|
-
})
|
|
14
|
-
.catch(function (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'content-type': 'multipart/form-data; boundary=---011000010111000001101001' },
|
|
7
|
-
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="foo"; filename="hello.txt"\r\nContent-Type: text/plain\r\n\r\nHello World\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="bar"\r\n\r\nBonjour le monde\r\n-----011000010111000001101001--\r\n'
|
|
8
|
-
};
|
|
9
|
-
axios
|
|
10
|
-
.request(options)
|
|
11
|
-
.then(function (response) {
|
|
12
|
-
console.log(response.data);
|
|
13
|
-
})
|
|
14
|
-
.catch(function (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'content-type': 'multipart/form-data; boundary=---011000010111000001101001' },
|
|
7
|
-
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="foo"; filename="hello.txt"\r\nContent-Type: text/plain\r\n\r\n\r\n-----011000010111000001101001--\r\n'
|
|
8
|
-
};
|
|
9
|
-
axios
|
|
10
|
-
.request(options)
|
|
11
|
-
.then(function (response) {
|
|
12
|
-
console.log(response.data);
|
|
13
|
-
})
|
|
14
|
-
.catch(function (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'Content-Type': 'multipart/form-data' }
|
|
7
|
-
};
|
|
8
|
-
axios
|
|
9
|
-
.request(options)
|
|
10
|
-
.then(function (response) {
|
|
11
|
-
console.log(response.data);
|
|
12
|
-
})
|
|
13
|
-
.catch(function (error) {
|
|
14
|
-
console.error(error);
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var axios = require('axios');
|
|
3
|
-
var options = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
url: 'https://httpbin.org/anything',
|
|
6
|
-
headers: { 'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001' },
|
|
7
|
-
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="foo"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n'
|
|
8
|
-
};
|
|
9
|
-
axios
|
|
10
|
-
.request(options)
|
|
11
|
-
.then(function (response) {
|
|
12
|
-
console.log(response.data);
|
|
13
|
-
})
|
|
14
|
-
.catch(function (error) {
|
|
15
|
-
console.error(error);
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|