@readme/httpsnippet 6.2.1 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-XPUGYZ4Y.mjs +3485 -0
- package/dist/chunk-XPUGYZ4Y.mjs.map +1 -0
- package/dist/index-acc66e3d.d.ts +167 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -95
- package/dist/index.js +3777 -261
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +299 -0
- package/dist/index.mjs.map +1 -0
- package/dist/targets/targets.d.mts +4 -0
- package/dist/targets/targets.d.ts +4 -53
- package/dist/targets/targets.js +3476 -113
- package/dist/targets/targets.js.map +1 -0
- package/dist/targets/targets.mjs +3 -0
- package/dist/targets/targets.mjs.map +1 -0
- package/package.json +40 -14
- package/dist/helpers/code-builder.d.ts +0 -49
- package/dist/helpers/code-builder.js +0 -91
- package/dist/helpers/escape.d.ts +0 -46
- package/dist/helpers/escape.js +0 -101
- package/dist/helpers/form-data.d.ts +0 -30
- package/dist/helpers/form-data.js +0 -157
- package/dist/helpers/headers.d.ts +0 -18
- package/dist/helpers/headers.js +0 -33
- package/dist/helpers/reducer.d.ts +0 -5
- package/dist/helpers/reducer.js +0 -19
- package/dist/helpers/shell.d.ts +0 -6
- package/dist/helpers/shell.js +0 -20
- package/dist/helpers/utils.d.ts +0 -6
- package/dist/helpers/utils.js +0 -21
- package/dist/targets/c/libcurl/client.d.ts +0 -2
- package/dist/targets/c/libcurl/client.js +0 -45
- package/dist/targets/c/target.d.ts +0 -2
- package/dist/targets/c/target.js +0 -16
- package/dist/targets/clojure/clj_http/client.d.ts +0 -11
- package/dist/targets/clojure/clj_http/client.js +0 -178
- package/dist/targets/clojure/target.d.ts +0 -2
- package/dist/targets/clojure/target.js +0 -15
- package/dist/targets/csharp/httpclient/client.d.ts +0 -2
- package/dist/targets/csharp/httpclient/client.js +0 -163
- package/dist/targets/csharp/restsharp/client.d.ts +0 -2
- package/dist/targets/csharp/restsharp/client.js +0 -92
- package/dist/targets/csharp/target.d.ts +0 -2
- package/dist/targets/csharp/target.js +0 -18
- package/dist/targets/go/native/client.d.ts +0 -17
- package/dist/targets/go/native/client.js +0 -103
- package/dist/targets/go/target.d.ts +0 -2
- package/dist/targets/go/target.js +0 -16
- package/dist/targets/http/http1.1/client.d.ts +0 -23
- package/dist/targets/http/http1.1/client.js +0 -69
- package/dist/targets/http/target.d.ts +0 -2
- package/dist/targets/http/target.js +0 -15
- package/dist/targets/java/asynchttp/client.d.ts +0 -11
- package/dist/targets/java/asynchttp/client.js +0 -45
- package/dist/targets/java/nethttp/client.d.ts +0 -14
- package/dist/targets/java/nethttp/client.js +0 -44
- package/dist/targets/java/okhttp/client.d.ts +0 -11
- package/dist/targets/java/okhttp/client.js +0 -71
- package/dist/targets/java/target.d.ts +0 -2
- package/dist/targets/java/target.js +0 -21
- package/dist/targets/java/unirest/client.d.ts +0 -11
- package/dist/targets/java/unirest/client.js +0 -45
- package/dist/targets/javascript/axios/client.d.ts +0 -11
- package/dist/targets/javascript/axios/client.js +0 -92
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +0 -23
- package/dist/targets/javascript/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-json.js +0 -27
- package/dist/targets/javascript/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/cookies.js +0 -19
- package/dist/targets/javascript/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/custom-method.js +0 -15
- package/dist/targets/javascript/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/full.js +0 -27
- package/dist/targets/javascript/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/headers.js +0 -24
- package/dist/targets/javascript/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/http-insecure.js +0 -15
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +0 -20
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +0 -20
- package/dist/targets/javascript/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-data.js +0 -23
- package/dist/targets/javascript/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-file.js +0 -22
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +0 -19
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +0 -22
- package/dist/targets/javascript/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/nested.js +0 -19
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +0 -19
- package/dist/targets/javascript/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query-encoded.js +0 -22
- package/dist/targets/javascript/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query.js +0 -19
- package/dist/targets/javascript/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/short.js +0 -15
- package/dist/targets/javascript/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/text-plain.js +0 -20
- package/dist/targets/javascript/fetch/client.d.ts +0 -15
- package/dist/targets/javascript/fetch/client.js +0 -106
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.d.ts +0 -8
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/application-json.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/application-json.js +0 -17
- package/dist/targets/javascript/fetch/fixtures/cookies.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/cookies.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/custom-method.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/custom-method.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/full.d.ts +0 -10
- package/dist/targets/javascript/fetch/fixtures/full.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/headers.d.ts +0 -9
- package/dist/targets/javascript/fetch/fixtures/headers.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/http-insecure.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/http-insecure.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-data.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-file.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-file.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/nested.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/nested.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query-encoded.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query-encoded.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/short.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/short.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/text-plain.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/text-plain.js +0 -6
- package/dist/targets/javascript/jquery/client.d.ts +0 -11
- package/dist/targets/javascript/jquery/client.js +0 -84
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.d.ts +0 -13
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/application-json.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/application-json.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/cookies.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/cookies.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/custom-method.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/full.d.ts +0 -14
- package/dist/targets/javascript/jquery/fixtures/full.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/headers.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/headers.js +0 -16
- package/dist/targets/javascript/jquery/fixtures/http-insecure.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/multipart-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-data.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/multipart-file.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-file.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/nested.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/nested.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/query-encoded.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/query.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/short.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/short.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/text-plain.d.ts +0 -10
- package/dist/targets/javascript/jquery/fixtures/text-plain.js +0 -14
- package/dist/targets/javascript/target.d.ts +0 -2
- package/dist/targets/javascript/target.js +0 -21
- package/dist/targets/javascript/xhr/client.d.ts +0 -14
- package/dist/targets/javascript/xhr/client.js +0 -83
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/application-json.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-json.js +0 -31
- package/dist/targets/javascript/xhr/fixtures/cookies.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cookies.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/cors.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cors.js +0 -10
- package/dist/targets/javascript/xhr/fixtures/custom-method.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/full.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/full.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/headers.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/headers.js +0 -15
- package/dist/targets/javascript/xhr/fixtures/http-insecure.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/multipart-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-data.js +0 -13
- package/dist/targets/javascript/xhr/fixtures/multipart-file.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-file.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/nested.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/nested.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/query-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/query.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/short.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/short.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/text-plain.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/text-plain.js +0 -12
- package/dist/targets/json/native/client.d.ts +0 -2
- package/dist/targets/json/native/client.js +0 -56
- package/dist/targets/json/target.d.ts +0 -2
- package/dist/targets/json/target.js +0 -15
- package/dist/targets/kotlin/okhttp/client.d.ts +0 -11
- package/dist/targets/kotlin/okhttp/client.js +0 -71
- package/dist/targets/kotlin/target.d.ts +0 -2
- package/dist/targets/kotlin/target.js +0 -15
- package/dist/targets/node/axios/client.d.ts +0 -11
- package/dist/targets/node/axios/client.js +0 -78
- package/dist/targets/node/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-form-encoded.js +0 -20
- package/dist/targets/node/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-json.js +0 -23
- package/dist/targets/node/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/cookies.js +0 -15
- package/dist/targets/node/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/custom-method.js +0 -11
- package/dist/targets/node/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/full.js +0 -23
- package/dist/targets/node/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/headers.js +0 -20
- package/dist/targets/node/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/http-insecure.js +0 -11
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +0 -16
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-data.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-file.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +0 -15
- package/dist/targets/node/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/nested.js +0 -14
- package/dist/targets/node/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/postdata-malformed.js +0 -15
- package/dist/targets/node/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query-encoded.js +0 -14
- package/dist/targets/node/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query.js +0 -14
- package/dist/targets/node/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/short.js +0 -11
- package/dist/targets/node/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/text-plain.js +0 -16
- package/dist/targets/node/fetch/client.d.ts +0 -11
- package/dist/targets/node/fetch/client.js +0 -140
- package/dist/targets/node/fetch/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-form-encoded.js +0 -16
- package/dist/targets/node/fetch/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-json.js +0 -19
- package/dist/targets/node/fetch/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/cookies.js +0 -8
- package/dist/targets/node/fetch/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/custom-method.js +0 -8
- package/dist/targets/node/fetch/fixtures/full.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/full.js +0 -19
- package/dist/targets/node/fetch/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/headers.js +0 -16
- package/dist/targets/node/fetch/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +0 -12
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +0 -12
- package/dist/targets/node/fetch/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-data.js +0 -14
- package/dist/targets/node/fetch/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-file.js +0 -13
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +0 -8
- package/dist/targets/node/fetch/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/node/fetch/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/nested.js +0 -8
- package/dist/targets/node/fetch/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/postdata-malformed.js +0 -8
- package/dist/targets/node/fetch/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query-encoded.js +0 -8
- package/dist/targets/node/fetch/fixtures/query.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query.js +0 -8
- package/dist/targets/node/fetch/fixtures/short.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/short.js +0 -8
- package/dist/targets/node/fetch/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/text-plain.js +0 -8
- package/dist/targets/node/native/client.d.ts +0 -11
- package/dist/targets/node/native/client.js +0 -72
- package/dist/targets/node/native/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-form-encoded.js +0 -24
- package/dist/targets/node/native/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-json.js +0 -30
- package/dist/targets/node/native/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/native/fixtures/cookies.js +0 -22
- package/dist/targets/node/native/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/native/fixtures/custom-method.js +0 -20
- package/dist/targets/node/native/fixtures/full.d.ts +0 -1
- package/dist/targets/node/native/fixtures/full.js +0 -26
- package/dist/targets/node/native/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/native/fixtures/headers.js +0 -25
- package/dist/targets/node/native/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/native/fixtures/http-insecure.js +0 -20
- package/dist/targets/node/native/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-multiline.js +0 -23
- package/dist/targets/node/native/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-null-value.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-data.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-file.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.js +0 -22
- package/dist/targets/node/native/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data.js +0 -23
- package/dist/targets/node/native/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/native/fixtures/nested.js +0 -20
- package/dist/targets/node/native/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/native/fixtures/postdata-malformed.js +0 -22
- package/dist/targets/node/native/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query-encoded.js +0 -20
- package/dist/targets/node/native/fixtures/query.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query.js +0 -20
- package/dist/targets/node/native/fixtures/short.d.ts +0 -1
- package/dist/targets/node/native/fixtures/short.js +0 -20
- package/dist/targets/node/native/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/native/fixtures/text-plain.js +0 -23
- package/dist/targets/node/request/client.d.ts +0 -11
- package/dist/targets/node/request/client.js +0 -107
- package/dist/targets/node/request/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-form-encoded.js +0 -13
- package/dist/targets/node/request/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-json.js +0 -21
- package/dist/targets/node/request/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/request/fixtures/cookies.js +0 -11
- package/dist/targets/node/request/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/request/fixtures/custom-method.js +0 -8
- package/dist/targets/node/request/fixtures/full.d.ts +0 -1
- package/dist/targets/node/request/fixtures/full.js +0 -20
- package/dist/targets/node/request/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/request/fixtures/headers.js +0 -17
- package/dist/targets/node/request/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/request/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/request/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/node/request/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/node/request/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/request/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-file.js +0 -19
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.js +0 -12
- package/dist/targets/node/request/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data.js +0 -13
- package/dist/targets/node/request/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/request/fixtures/nested.js +0 -11
- package/dist/targets/node/request/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/request/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/node/request/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query-encoded.js +0 -11
- package/dist/targets/node/request/fixtures/query.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query.js +0 -11
- package/dist/targets/node/request/fixtures/short.d.ts +0 -1
- package/dist/targets/node/request/fixtures/short.js +0 -8
- package/dist/targets/node/request/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/request/fixtures/text-plain.js +0 -13
- package/dist/targets/node/target.d.ts +0 -2
- package/dist/targets/node/target.js +0 -24
- package/dist/targets/node/unirest/client.d.ts +0 -11
- package/dist/targets/node/unirest/client.js +0 -110
- package/dist/targets/node/unirest/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-form-encoded.js +0 -15
- package/dist/targets/node/unirest/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-json.js +0 -32
- package/dist/targets/node/unirest/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/cookies.js +0 -12
- package/dist/targets/node/unirest/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/custom-method.js +0 -8
- package/dist/targets/node/unirest/fixtures/full.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/full.js +0 -27
- package/dist/targets/node/unirest/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/headers.js +0 -14
- package/dist/targets/node/unirest/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/node/unirest/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/unirest/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-file.js +0 -18
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/node/unirest/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/unirest/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/nested.js +0 -13
- package/dist/targets/node/unirest/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/postdata-malformed.js +0 -11
- package/dist/targets/node/unirest/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query-encoded.js +0 -12
- package/dist/targets/node/unirest/fixtures/query.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query.js +0 -16
- package/dist/targets/node/unirest/fixtures/short.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/short.js +0 -8
- package/dist/targets/node/unirest/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/text-plain.js +0 -12
- package/dist/targets/objc/helpers.d.ts +0 -26
- package/dist/targets/objc/helpers.js +0 -59
- package/dist/targets/objc/nsurlsession/client.d.ts +0 -15
- package/dist/targets/objc/nsurlsession/client.js +0 -143
- package/dist/targets/objc/target.d.ts +0 -2
- package/dist/targets/objc/target.js +0 -15
- package/dist/targets/ocaml/cohttp/client.d.ts +0 -11
- package/dist/targets/ocaml/cohttp/client.js +0 -64
- package/dist/targets/ocaml/target.d.ts +0 -2
- package/dist/targets/ocaml/target.js +0 -15
- package/dist/targets/php/curl/client.d.ts +0 -19
- package/dist/targets/php/curl/client.js +0 -122
- package/dist/targets/php/guzzle/client.d.ts +0 -17
- package/dist/targets/php/guzzle/client.js +0 -119
- package/dist/targets/php/helpers.d.ts +0 -2
- package/dist/targets/php/helpers.js +0 -66
- package/dist/targets/php/http1/client.d.ts +0 -16
- package/dist/targets/php/http1/client.js +0 -76
- package/dist/targets/php/http2/client.d.ts +0 -16
- package/dist/targets/php/http2/client.js +0 -115
- package/dist/targets/php/target.d.ts +0 -2
- package/dist/targets/php/target.js +0 -22
- package/dist/targets/powershell/common.d.ts +0 -3
- package/dist/targets/powershell/common.js +0 -50
- package/dist/targets/powershell/restmethod/client.d.ts +0 -2
- package/dist/targets/powershell/restmethod/client.js +0 -13
- package/dist/targets/powershell/target.d.ts +0 -2
- package/dist/targets/powershell/target.js +0 -17
- package/dist/targets/powershell/webrequest/client.d.ts +0 -2
- package/dist/targets/powershell/webrequest/client.js +0 -13
- package/dist/targets/python/helpers.d.ts +0 -8
- package/dist/targets/python/helpers.js +0 -64
- package/dist/targets/python/requests/client.d.ts +0 -14
- package/dist/targets/python/requests/client.js +0 -162
- package/dist/targets/python/target.d.ts +0 -2
- package/dist/targets/python/target.js +0 -16
- package/dist/targets/r/httr/client.d.ts +0 -11
- package/dist/targets/r/httr/client.js +0 -130
- package/dist/targets/r/target.d.ts +0 -2
- package/dist/targets/r/target.js +0 -15
- package/dist/targets/ruby/native/client.d.ts +0 -2
- package/dist/targets/ruby/native/client.js +0 -67
- package/dist/targets/ruby/target.d.ts +0 -2
- package/dist/targets/ruby/target.js +0 -15
- package/dist/targets/shell/curl/client.d.ts +0 -19
- package/dist/targets/shell/curl/client.js +0 -166
- package/dist/targets/shell/httpie/client.d.ts +0 -24
- package/dist/targets/shell/httpie/client.js +0 -102
- package/dist/targets/shell/target.d.ts +0 -2
- package/dist/targets/shell/target.js +0 -20
- package/dist/targets/shell/wget/client.d.ts +0 -16
- package/dist/targets/shell/wget/client.js +0 -46
- package/dist/targets/swift/helpers.d.ts +0 -16
- package/dist/targets/swift/helpers.js +0 -80
- package/dist/targets/swift/nsurlsession/client.d.ts +0 -15
- package/dist/targets/swift/nsurlsession/client.js +0 -148
- package/dist/targets/swift/target.d.ts +0 -2
- package/dist/targets/swift/target.js +0 -15
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.native = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var escape_1 = require("../../../helpers/escape");
|
|
6
|
-
exports.native = {
|
|
7
|
-
info: {
|
|
8
|
-
key: 'native',
|
|
9
|
-
title: 'NewRequest',
|
|
10
|
-
link: 'http://golang.org/pkg/net/http/#NewRequest',
|
|
11
|
-
description: 'Golang HTTP client request',
|
|
12
|
-
},
|
|
13
|
-
convert: function (_a, options) {
|
|
14
|
-
var postData = _a.postData, method = _a.method, allHeaders = _a.allHeaders, fullUrl = _a.fullUrl;
|
|
15
|
-
if (options === void 0) { options = {}; }
|
|
16
|
-
var _b = new code_builder_1.CodeBuilder({ indent: '\t' }), blank = _b.blank, push = _b.push, join = _b.join;
|
|
17
|
-
var _c = options.showBoilerplate, showBoilerplate = _c === void 0 ? true : _c, _d = options.checkErrors, checkErrors = _d === void 0 ? false : _d, _e = options.printBody, printBody = _e === void 0 ? true : _e, _f = options.timeout, timeout = _f === void 0 ? -1 : _f;
|
|
18
|
-
var errorPlaceholder = checkErrors ? 'err' : '_';
|
|
19
|
-
var indent = showBoilerplate ? 1 : 0;
|
|
20
|
-
var errorCheck = function () {
|
|
21
|
-
if (checkErrors) {
|
|
22
|
-
push('if err != nil {', indent);
|
|
23
|
-
push('panic(err)', indent + 1);
|
|
24
|
-
push('}', indent);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
// Create boilerplate
|
|
28
|
-
if (showBoilerplate) {
|
|
29
|
-
push('package main');
|
|
30
|
-
blank();
|
|
31
|
-
push('import (');
|
|
32
|
-
push('"fmt"', indent);
|
|
33
|
-
if (timeout > 0) {
|
|
34
|
-
push('"time"', indent);
|
|
35
|
-
}
|
|
36
|
-
if (postData.text) {
|
|
37
|
-
push('"strings"', indent);
|
|
38
|
-
}
|
|
39
|
-
push('"net/http"', indent);
|
|
40
|
-
if (printBody) {
|
|
41
|
-
push('"io"', indent);
|
|
42
|
-
}
|
|
43
|
-
push(')');
|
|
44
|
-
blank();
|
|
45
|
-
push('func main() {');
|
|
46
|
-
blank();
|
|
47
|
-
}
|
|
48
|
-
// Create client
|
|
49
|
-
var hasTimeout = timeout > 0;
|
|
50
|
-
var hasClient = hasTimeout;
|
|
51
|
-
var client = hasClient ? 'client' : 'http.DefaultClient';
|
|
52
|
-
if (hasClient) {
|
|
53
|
-
push('client := http.Client{', indent);
|
|
54
|
-
if (hasTimeout) {
|
|
55
|
-
push("Timeout: time.Duration(".concat(timeout, " * time.Second),"), indent + 1);
|
|
56
|
-
}
|
|
57
|
-
push('}', indent);
|
|
58
|
-
blank();
|
|
59
|
-
}
|
|
60
|
-
push("url := \"".concat(fullUrl, "\""), indent);
|
|
61
|
-
blank();
|
|
62
|
-
// If we have body content or not create the var and reader or nil
|
|
63
|
-
if (postData.text) {
|
|
64
|
-
push("payload := strings.NewReader(".concat(JSON.stringify(postData.text), ")"), indent);
|
|
65
|
-
blank();
|
|
66
|
-
push("req, ".concat(errorPlaceholder, " := http.NewRequest(\"").concat(method, "\", url, payload)"), indent);
|
|
67
|
-
blank();
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
push("req, ".concat(errorPlaceholder, " := http.NewRequest(\"").concat(method, "\", url, nil)"), indent);
|
|
71
|
-
blank();
|
|
72
|
-
}
|
|
73
|
-
errorCheck();
|
|
74
|
-
// Add headers
|
|
75
|
-
if (Object.keys(allHeaders).length) {
|
|
76
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
77
|
-
push("req.Header.Add(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\")"), indent);
|
|
78
|
-
});
|
|
79
|
-
blank();
|
|
80
|
-
}
|
|
81
|
-
// Make request
|
|
82
|
-
push("res, ".concat(errorPlaceholder, " := ").concat(client, ".Do(req)"), indent);
|
|
83
|
-
errorCheck();
|
|
84
|
-
// Get Body
|
|
85
|
-
if (printBody) {
|
|
86
|
-
blank();
|
|
87
|
-
push('defer res.Body.Close()', indent);
|
|
88
|
-
push("body, ".concat(errorPlaceholder, " := io.ReadAll(res.Body)"), indent);
|
|
89
|
-
errorCheck();
|
|
90
|
-
}
|
|
91
|
-
// Print it
|
|
92
|
-
blank();
|
|
93
|
-
if (printBody) {
|
|
94
|
-
push('fmt.Println(string(body))', indent);
|
|
95
|
-
}
|
|
96
|
-
// End main block
|
|
97
|
-
if (showBoilerplate) {
|
|
98
|
-
blank();
|
|
99
|
-
push('}');
|
|
100
|
-
}
|
|
101
|
-
return join();
|
|
102
|
-
},
|
|
103
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.go = void 0;
|
|
4
|
-
var client_1 = require("./native/client");
|
|
5
|
-
exports.go = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'go',
|
|
8
|
-
title: 'Go',
|
|
9
|
-
extname: '.go',
|
|
10
|
-
default: 'native',
|
|
11
|
-
cli: 'go',
|
|
12
|
-
},
|
|
13
|
-
clientsById: {
|
|
14
|
-
native: client_1.native,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator to generate raw HTTP/1.1 request strings,
|
|
4
|
-
* in accordance to the RFC 7230 (and RFC 7231) specifications.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @irvinlim
|
|
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
|
-
interface Http11Options {
|
|
13
|
-
absoluteURI?: boolean;
|
|
14
|
-
autoContentLength?: boolean;
|
|
15
|
-
autoHost?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Request follows the request message format in accordance to RFC 7230, Section 3.
|
|
19
|
-
* Each section is prepended with the RFC and section number.
|
|
20
|
-
* See more at https://tools.ietf.org/html/rfc7230#section-3.
|
|
21
|
-
*/
|
|
22
|
-
export declare const http11: Client<Http11Options>;
|
|
23
|
-
export {};
|
|
@@ -1,69 +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.http11 = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var CRLF = '\r\n';
|
|
17
|
-
/**
|
|
18
|
-
* Request follows the request message format in accordance to RFC 7230, Section 3.
|
|
19
|
-
* Each section is prepended with the RFC and section number.
|
|
20
|
-
* See more at https://tools.ietf.org/html/rfc7230#section-3.
|
|
21
|
-
*/
|
|
22
|
-
exports.http11 = {
|
|
23
|
-
info: {
|
|
24
|
-
key: 'http1.1',
|
|
25
|
-
title: 'HTTP/1.1',
|
|
26
|
-
link: 'https://tools.ietf.org/html/rfc7230',
|
|
27
|
-
description: 'HTTP/1.1 request string in accordance with RFC 7230',
|
|
28
|
-
},
|
|
29
|
-
convert: function (_a, options) {
|
|
30
|
-
var method = _a.method, fullUrl = _a.fullUrl, uriObj = _a.uriObj, httpVersion = _a.httpVersion, allHeaders = _a.allHeaders, postData = _a.postData;
|
|
31
|
-
var opts = __assign({ absoluteURI: false, autoContentLength: true, autoHost: true }, options);
|
|
32
|
-
// RFC 7230 Section 3. Message Format
|
|
33
|
-
// All lines have no indentation, and should be terminated with CRLF.
|
|
34
|
-
var _b = new code_builder_1.CodeBuilder({ indent: '', join: CRLF }), blank = _b.blank, push = _b.push, join = _b.join;
|
|
35
|
-
// RFC 7230 Section 5.3. Request Target
|
|
36
|
-
// Determines if the Request-Line should use 'absolute-form' or 'origin-form'.
|
|
37
|
-
// Basically it means whether the "http://domain.com" will prepend the full url.
|
|
38
|
-
var requestUrl = opts.absoluteURI ? fullUrl : uriObj.path;
|
|
39
|
-
// RFC 7230 Section 3.1.1. Request-Line
|
|
40
|
-
push("".concat(method, " ").concat(requestUrl, " ").concat(httpVersion));
|
|
41
|
-
var headerKeys = Object.keys(allHeaders);
|
|
42
|
-
// RFC 7231 Section 5. Header Fields
|
|
43
|
-
headerKeys.forEach(function (key) {
|
|
44
|
-
// Capitalize header keys, even though it's not required by the spec.
|
|
45
|
-
var keyCapitalized = key.toLowerCase().replace(/(^|-)(\w)/g, function (input) { return input.toUpperCase(); });
|
|
46
|
-
push("".concat(keyCapitalized, ": ").concat(allHeaders[key]));
|
|
47
|
-
});
|
|
48
|
-
// RFC 7230 Section 5.4. Host
|
|
49
|
-
// Automatically set Host header if option is on and on header already exists.
|
|
50
|
-
if (opts.autoHost && !headerKeys.includes('host')) {
|
|
51
|
-
push("Host: ".concat(uriObj.host));
|
|
52
|
-
}
|
|
53
|
-
// RFC 7230 Section 3.3.3. Message Body Length
|
|
54
|
-
// Automatically set Content-Length header if option is on, postData is present and no header already exists.
|
|
55
|
-
if (opts.autoContentLength && postData.text && !headerKeys.includes('content-length')) {
|
|
56
|
-
var length = Buffer.byteLength(postData.text, 'ascii').toString();
|
|
57
|
-
push("Content-Length: ".concat(length));
|
|
58
|
-
}
|
|
59
|
-
// Add extra line after header section.
|
|
60
|
-
blank();
|
|
61
|
-
// Separate header section and message body section.
|
|
62
|
-
var headerSection = join();
|
|
63
|
-
// RFC 7230 Section 3.3. Message Body
|
|
64
|
-
var messageBody = postData.text || '';
|
|
65
|
-
// RFC 7230 Section 3. Message Format
|
|
66
|
-
// Extra CRLF separating the headers from the body.
|
|
67
|
-
return "".concat(headerSection).concat(CRLF).concat(messageBody);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.http = void 0;
|
|
4
|
-
var client_1 = require("./http1.1/client");
|
|
5
|
-
exports.http = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'http',
|
|
8
|
-
title: 'HTTP',
|
|
9
|
-
extname: null,
|
|
10
|
-
default: '1.1',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
'http1.1': client_1.http11,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* Asynchronous Http and WebSocket Client library for Java
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @windard
|
|
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 asynchttp: Client;
|
|
@@ -1,45 +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.asynchttp = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
exports.asynchttp = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'asynchttp',
|
|
20
|
-
title: 'AsyncHttp',
|
|
21
|
-
link: 'https://github.com/AsyncHttpClient/async-http-client',
|
|
22
|
-
description: 'Asynchronous Http and WebSocket Client library for Java',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var method = _a.method, allHeaders = _a.allHeaders, postData = _a.postData, fullUrl = _a.fullUrl;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), blank = _b.blank, push = _b.push, join = _b.join;
|
|
28
|
-
push('AsyncHttpClient client = new DefaultAsyncHttpClient();');
|
|
29
|
-
push("client.prepare(\"".concat(method.toUpperCase(), "\", \"").concat(fullUrl, "\")"));
|
|
30
|
-
// Add headers, including the cookies
|
|
31
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
32
|
-
push(".setHeader(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\")"), 1);
|
|
33
|
-
});
|
|
34
|
-
if (postData.text) {
|
|
35
|
-
push(".setBody(".concat(JSON.stringify(postData.text), ")"), 1);
|
|
36
|
-
}
|
|
37
|
-
push('.execute()', 1);
|
|
38
|
-
push('.toCompletableFuture()', 1);
|
|
39
|
-
push('.thenAccept(System.out::println)', 1);
|
|
40
|
-
push('.join();', 1);
|
|
41
|
-
blank();
|
|
42
|
-
push('client.close();');
|
|
43
|
-
return join();
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Java using java.net.http.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @wtetsu
|
|
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 NetHttpOptions {
|
|
12
|
-
indent?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const nethttp: Client;
|
|
@@ -1,44 +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.nethttp = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
exports.nethttp = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'nethttp',
|
|
20
|
-
title: 'java.net.http',
|
|
21
|
-
link: 'https://openjdk.java.net/groups/net/httpclient/intro.html',
|
|
22
|
-
description: 'Java Standardized HTTP Client API',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var allHeaders = _a.allHeaders, fullUrl = _a.fullUrl, method = _a.method, postData = _a.postData;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _b.push, join = _b.join;
|
|
28
|
-
push('HttpRequest request = HttpRequest.newBuilder()');
|
|
29
|
-
push(".uri(URI.create(\"".concat(fullUrl, "\"))"), 2);
|
|
30
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
31
|
-
push(".header(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\")"), 2);
|
|
32
|
-
});
|
|
33
|
-
if (postData.text) {
|
|
34
|
-
push(".method(\"".concat(method.toUpperCase(), "\", HttpRequest.BodyPublishers.ofString(").concat(JSON.stringify(postData.text), "))"), 2);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
push(".method(\"".concat(method.toUpperCase(), "\", HttpRequest.BodyPublishers.noBody())"), 2);
|
|
38
|
-
}
|
|
39
|
-
push('.build();', 2);
|
|
40
|
-
push('HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());');
|
|
41
|
-
push('System.out.println(response.body());');
|
|
42
|
-
return join();
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Java using OkHttp.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @shashiranjan84
|
|
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, method = _a.method, fullUrl = _a.fullUrl, allHeaders = _a.allHeaders;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _b.push, blank = _b.blank, join = _b.join;
|
|
28
|
-
var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
29
|
-
var methodsWithBody = ['POST', 'PUT', 'DELETE', 'PATCH'];
|
|
30
|
-
push('OkHttpClient client = new OkHttpClient();');
|
|
31
|
-
blank();
|
|
32
|
-
if (postData.text) {
|
|
33
|
-
if (postData.boundary) {
|
|
34
|
-
push("MediaType mediaType = MediaType.parse(\"".concat(postData.mimeType, "; boundary=").concat(postData.boundary, "\");"));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
push("MediaType mediaType = MediaType.parse(\"".concat(postData.mimeType, "\");"));
|
|
38
|
-
}
|
|
39
|
-
push("RequestBody body = RequestBody.create(mediaType, ".concat(JSON.stringify(postData.text), ");"));
|
|
40
|
-
}
|
|
41
|
-
push('Request request = new 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('Response response = client.newCall(request).execute();');
|
|
69
|
-
return join();
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.java = void 0;
|
|
4
|
-
var client_1 = require("./asynchttp/client");
|
|
5
|
-
var client_2 = require("./nethttp/client");
|
|
6
|
-
var client_3 = require("./okhttp/client");
|
|
7
|
-
var client_4 = require("./unirest/client");
|
|
8
|
-
exports.java = {
|
|
9
|
-
info: {
|
|
10
|
-
key: 'java',
|
|
11
|
-
title: 'Java',
|
|
12
|
-
extname: '.java',
|
|
13
|
-
default: 'unirest',
|
|
14
|
-
},
|
|
15
|
-
clientsById: {
|
|
16
|
-
asynchttp: client_1.asynchttp,
|
|
17
|
-
nethttp: client_2.nethttp,
|
|
18
|
-
okhttp: client_3.okhttp,
|
|
19
|
-
unirest: client_4.unirest,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for Java using Unirest.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @shashiranjan84
|
|
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 unirest: Client;
|
|
@@ -1,45 +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.unirest = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
exports.unirest = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'unirest',
|
|
20
|
-
title: 'Unirest',
|
|
21
|
-
link: 'http://unirest.io/java.html',
|
|
22
|
-
description: 'Lightweight HTTP Request Client Library',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var method = _a.method, allHeaders = _a.allHeaders, postData = _a.postData, fullUrl = _a.fullUrl;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), join = _b.join, push = _b.push;
|
|
28
|
-
var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'];
|
|
29
|
-
if (!methods.includes(method.toUpperCase())) {
|
|
30
|
-
push("HttpResponse<String> response = Unirest.customMethod(\"".concat(method.toUpperCase(), "\",\"").concat(fullUrl, "\")"));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
push("HttpResponse<String> response = Unirest.".concat(method.toLowerCase(), "(\"").concat(fullUrl, "\")"));
|
|
34
|
-
}
|
|
35
|
-
// Add headers, including the cookies
|
|
36
|
-
Object.keys(allHeaders).forEach(function (key) {
|
|
37
|
-
push(".header(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\")"), 1);
|
|
38
|
-
});
|
|
39
|
-
if (postData.text) {
|
|
40
|
-
push(".body(".concat(JSON.stringify(postData.text), ")"), 1);
|
|
41
|
-
}
|
|
42
|
-
push('.asString();', 1);
|
|
43
|
-
return join();
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -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,92 +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 allHeaders = _a.allHeaders, method = _a.method, url = _a.url, queryObj = _a.queryObj, postData = _a.postData;
|
|
29
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
30
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), blank = _b.blank, push = _b.push, join = _b.join, addPostProcessor = _b.addPostProcessor;
|
|
31
|
-
push("import axios from 'axios';");
|
|
32
|
-
blank();
|
|
33
|
-
var requestOptions = {
|
|
34
|
-
method: method,
|
|
35
|
-
url: url,
|
|
36
|
-
};
|
|
37
|
-
if (Object.keys(queryObj).length) {
|
|
38
|
-
requestOptions.params = queryObj;
|
|
39
|
-
}
|
|
40
|
-
if (Object.keys(allHeaders).length) {
|
|
41
|
-
requestOptions.headers = allHeaders;
|
|
42
|
-
}
|
|
43
|
-
switch (postData.mimeType) {
|
|
44
|
-
case 'application/x-www-form-urlencoded':
|
|
45
|
-
if (postData.params) {
|
|
46
|
-
push('const encodedParams = new URLSearchParams();');
|
|
47
|
-
postData.params.forEach(function (param) {
|
|
48
|
-
push("encodedParams.set('".concat(param.name, "', '").concat(param.value, "');"));
|
|
49
|
-
});
|
|
50
|
-
blank();
|
|
51
|
-
requestOptions.data = 'encodedParams,';
|
|
52
|
-
addPostProcessor(function (code) { return code.replace(/'encodedParams,'/, 'encodedParams,'); });
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
case 'application/json':
|
|
56
|
-
if (postData.jsonObj) {
|
|
57
|
-
requestOptions.data = postData.jsonObj;
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case 'multipart/form-data':
|
|
61
|
-
if (!postData.params) {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
push('const form = new FormData();');
|
|
65
|
-
postData.params.forEach(function (param) {
|
|
66
|
-
push("form.append('".concat(param.name, "', '").concat(param.value || param.fileName || '', "');"));
|
|
67
|
-
});
|
|
68
|
-
blank();
|
|
69
|
-
requestOptions.data = '[form]';
|
|
70
|
-
break;
|
|
71
|
-
default:
|
|
72
|
-
if (postData.text) {
|
|
73
|
-
requestOptions.data = postData.text;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
var optionString = (0, stringify_object_1.default)(requestOptions, {
|
|
77
|
-
indent: ' ',
|
|
78
|
-
inlineCharacterLimit: 80,
|
|
79
|
-
}).replace('"[form]"', 'form');
|
|
80
|
-
push("const options = ".concat(optionString, ";"));
|
|
81
|
-
blank();
|
|
82
|
-
push('axios');
|
|
83
|
-
push('.request(options)', 1);
|
|
84
|
-
push('.then(function (response) {', 1);
|
|
85
|
-
push('console.log(response.data);', 2);
|
|
86
|
-
push('})', 1);
|
|
87
|
-
push('.catch(function (error) {', 1);
|
|
88
|
-
push('console.error(error);', 2);
|
|
89
|
-
push('});', 1);
|
|
90
|
-
return join();
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var axios_1 = __importDefault(require("axios"));
|
|
7
|
-
var encodedParams = new URLSearchParams();
|
|
8
|
-
encodedParams.set('foo', 'bar');
|
|
9
|
-
encodedParams.set('hello', 'world');
|
|
10
|
-
var options = {
|
|
11
|
-
method: 'POST',
|
|
12
|
-
url: 'https://httpbin.org/anything',
|
|
13
|
-
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
14
|
-
data: encodedParams,
|
|
15
|
-
};
|
|
16
|
-
axios_1.default
|
|
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 {};
|