@readme/httpsnippet 6.2.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-XPUGYZ4Y.mjs +3485 -0
- package/dist/chunk-XPUGYZ4Y.mjs.map +1 -0
- package/dist/index-acc66e3d.d.ts +167 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -95
- package/dist/index.js +3777 -261
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +299 -0
- package/dist/index.mjs.map +1 -0
- package/dist/targets/targets.d.mts +4 -0
- package/dist/targets/targets.d.ts +4 -53
- package/dist/targets/targets.js +3476 -113
- package/dist/targets/targets.js.map +1 -0
- package/dist/targets/targets.mjs +3 -0
- package/dist/targets/targets.mjs.map +1 -0
- package/package.json +30 -14
- package/dist/helpers/code-builder.d.ts +0 -49
- package/dist/helpers/code-builder.js +0 -91
- package/dist/helpers/escape.d.ts +0 -46
- package/dist/helpers/escape.js +0 -101
- package/dist/helpers/form-data.d.ts +0 -30
- package/dist/helpers/form-data.js +0 -157
- package/dist/helpers/headers.d.ts +0 -18
- package/dist/helpers/headers.js +0 -33
- package/dist/helpers/reducer.d.ts +0 -5
- package/dist/helpers/reducer.js +0 -19
- package/dist/helpers/shell.d.ts +0 -6
- package/dist/helpers/shell.js +0 -20
- package/dist/helpers/utils.d.ts +0 -6
- package/dist/helpers/utils.js +0 -21
- package/dist/targets/c/libcurl/client.d.ts +0 -2
- package/dist/targets/c/libcurl/client.js +0 -45
- package/dist/targets/c/target.d.ts +0 -2
- package/dist/targets/c/target.js +0 -16
- package/dist/targets/clojure/clj_http/client.d.ts +0 -11
- package/dist/targets/clojure/clj_http/client.js +0 -178
- package/dist/targets/clojure/target.d.ts +0 -2
- package/dist/targets/clojure/target.js +0 -15
- package/dist/targets/csharp/httpclient/client.d.ts +0 -2
- package/dist/targets/csharp/httpclient/client.js +0 -163
- package/dist/targets/csharp/restsharp/client.d.ts +0 -2
- package/dist/targets/csharp/restsharp/client.js +0 -92
- package/dist/targets/csharp/target.d.ts +0 -2
- package/dist/targets/csharp/target.js +0 -18
- package/dist/targets/go/native/client.d.ts +0 -17
- package/dist/targets/go/native/client.js +0 -103
- package/dist/targets/go/target.d.ts +0 -2
- package/dist/targets/go/target.js +0 -16
- package/dist/targets/http/http1.1/client.d.ts +0 -23
- package/dist/targets/http/http1.1/client.js +0 -69
- package/dist/targets/http/target.d.ts +0 -2
- package/dist/targets/http/target.js +0 -15
- package/dist/targets/java/asynchttp/client.d.ts +0 -11
- package/dist/targets/java/asynchttp/client.js +0 -45
- package/dist/targets/java/nethttp/client.d.ts +0 -14
- package/dist/targets/java/nethttp/client.js +0 -44
- package/dist/targets/java/okhttp/client.d.ts +0 -11
- package/dist/targets/java/okhttp/client.js +0 -71
- package/dist/targets/java/target.d.ts +0 -2
- package/dist/targets/java/target.js +0 -21
- package/dist/targets/java/unirest/client.d.ts +0 -11
- package/dist/targets/java/unirest/client.js +0 -45
- package/dist/targets/javascript/axios/client.d.ts +0 -11
- package/dist/targets/javascript/axios/client.js +0 -92
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +0 -23
- package/dist/targets/javascript/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/application-json.js +0 -27
- package/dist/targets/javascript/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/cookies.js +0 -19
- package/dist/targets/javascript/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/custom-method.js +0 -15
- package/dist/targets/javascript/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/full.js +0 -27
- package/dist/targets/javascript/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/headers.js +0 -24
- package/dist/targets/javascript/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/http-insecure.js +0 -15
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +0 -20
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +0 -20
- package/dist/targets/javascript/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-data.js +0 -23
- package/dist/targets/javascript/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-file.js +0 -22
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +0 -19
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +0 -22
- package/dist/targets/javascript/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/nested.js +0 -19
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +0 -19
- package/dist/targets/javascript/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query-encoded.js +0 -22
- package/dist/targets/javascript/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/query.js +0 -19
- package/dist/targets/javascript/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/short.js +0 -15
- package/dist/targets/javascript/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/javascript/axios/fixtures/text-plain.js +0 -20
- package/dist/targets/javascript/fetch/client.d.ts +0 -15
- package/dist/targets/javascript/fetch/client.js +0 -106
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.d.ts +0 -8
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/application-json.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/application-json.js +0 -17
- package/dist/targets/javascript/fetch/fixtures/cookies.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/cookies.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/custom-method.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/custom-method.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/full.d.ts +0 -10
- package/dist/targets/javascript/fetch/fixtures/full.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/headers.d.ts +0 -9
- package/dist/targets/javascript/fetch/fixtures/headers.js +0 -14
- package/dist/targets/javascript/fetch/fixtures/http-insecure.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/http-insecure.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-data.js +0 -10
- package/dist/targets/javascript/fetch/fixtures/multipart-file.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-file.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.d.ts +0 -4
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +0 -9
- package/dist/targets/javascript/fetch/fixtures/nested.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/nested.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.d.ts +0 -6
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query-encoded.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query-encoded.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/query.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/query.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/short.d.ts +0 -3
- package/dist/targets/javascript/fetch/fixtures/short.js +0 -6
- package/dist/targets/javascript/fetch/fixtures/text-plain.d.ts +0 -7
- package/dist/targets/javascript/fetch/fixtures/text-plain.js +0 -6
- package/dist/targets/javascript/jquery/client.d.ts +0 -11
- package/dist/targets/javascript/jquery/client.js +0 -84
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.d.ts +0 -13
- package/dist/targets/javascript/jquery/fixtures/application-form-encoded.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/application-json.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/application-json.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/cookies.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/cookies.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/custom-method.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/full.d.ts +0 -14
- package/dist/targets/javascript/jquery/fixtures/full.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/headers.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/headers.js +0 -16
- package/dist/targets/javascript/jquery/fixtures/http-insecure.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.d.ts +0 -11
- package/dist/targets/javascript/jquery/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/javascript/jquery/fixtures/multipart-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-data.js +0 -18
- package/dist/targets/javascript/jquery/fixtures/multipart-file.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-file.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.d.ts +0 -12
- package/dist/targets/javascript/jquery/fixtures/multipart-form-data.js +0 -17
- package/dist/targets/javascript/jquery/fixtures/nested.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/nested.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.d.ts +0 -9
- package/dist/targets/javascript/jquery/fixtures/postdata-malformed.js +0 -13
- package/dist/targets/javascript/jquery/fixtures/query-encoded.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/query.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/query.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/short.d.ts +0 -7
- package/dist/targets/javascript/jquery/fixtures/short.js +0 -11
- package/dist/targets/javascript/jquery/fixtures/text-plain.d.ts +0 -10
- package/dist/targets/javascript/jquery/fixtures/text-plain.js +0 -14
- package/dist/targets/javascript/target.d.ts +0 -2
- package/dist/targets/javascript/target.js +0 -21
- package/dist/targets/javascript/xhr/client.d.ts +0 -14
- package/dist/targets/javascript/xhr/client.js +0 -83
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-form-encoded.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/application-json.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/application-json.js +0 -31
- package/dist/targets/javascript/xhr/fixtures/cookies.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cookies.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/cors.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/cors.js +0 -10
- package/dist/targets/javascript/xhr/fixtures/custom-method.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/custom-method.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/full.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/full.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/headers.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/headers.js +0 -15
- package/dist/targets/javascript/xhr/fixtures/http-insecure.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/http-insecure.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/javascript/xhr/fixtures/multipart-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-data.js +0 -13
- package/dist/targets/javascript/xhr/fixtures/multipart-file.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-file.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/nested.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/nested.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/javascript/xhr/fixtures/query-encoded.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query-encoded.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/query.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/query.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/short.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/short.js +0 -11
- package/dist/targets/javascript/xhr/fixtures/text-plain.d.ts +0 -2
- package/dist/targets/javascript/xhr/fixtures/text-plain.js +0 -12
- package/dist/targets/json/native/client.d.ts +0 -2
- package/dist/targets/json/native/client.js +0 -56
- package/dist/targets/json/target.d.ts +0 -2
- package/dist/targets/json/target.js +0 -15
- package/dist/targets/kotlin/okhttp/client.d.ts +0 -11
- package/dist/targets/kotlin/okhttp/client.js +0 -71
- package/dist/targets/kotlin/target.d.ts +0 -2
- package/dist/targets/kotlin/target.js +0 -15
- package/dist/targets/node/axios/client.d.ts +0 -11
- package/dist/targets/node/axios/client.js +0 -78
- package/dist/targets/node/axios/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-form-encoded.js +0 -20
- package/dist/targets/node/axios/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/application-json.js +0 -23
- package/dist/targets/node/axios/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/cookies.js +0 -15
- package/dist/targets/node/axios/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/custom-method.js +0 -11
- package/dist/targets/node/axios/fixtures/full.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/full.js +0 -23
- package/dist/targets/node/axios/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/headers.js +0 -20
- package/dist/targets/node/axios/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/http-insecure.js +0 -11
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +0 -16
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-data.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-file.js +0 -16
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +0 -15
- package/dist/targets/node/axios/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/axios/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/nested.js +0 -14
- package/dist/targets/node/axios/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/postdata-malformed.js +0 -15
- package/dist/targets/node/axios/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query-encoded.js +0 -14
- package/dist/targets/node/axios/fixtures/query.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/query.js +0 -14
- package/dist/targets/node/axios/fixtures/short.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/short.js +0 -11
- package/dist/targets/node/axios/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/axios/fixtures/text-plain.js +0 -16
- package/dist/targets/node/fetch/client.d.ts +0 -11
- package/dist/targets/node/fetch/client.js +0 -140
- package/dist/targets/node/fetch/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-form-encoded.js +0 -16
- package/dist/targets/node/fetch/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/application-json.js +0 -19
- package/dist/targets/node/fetch/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/cookies.js +0 -8
- package/dist/targets/node/fetch/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/custom-method.js +0 -8
- package/dist/targets/node/fetch/fixtures/full.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/full.js +0 -19
- package/dist/targets/node/fetch/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/headers.js +0 -16
- package/dist/targets/node/fetch/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +0 -12
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +0 -12
- package/dist/targets/node/fetch/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-data.js +0 -14
- package/dist/targets/node/fetch/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-file.js +0 -13
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +0 -8
- package/dist/targets/node/fetch/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data.js +0 -12
- package/dist/targets/node/fetch/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/nested.js +0 -8
- package/dist/targets/node/fetch/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/postdata-malformed.js +0 -8
- package/dist/targets/node/fetch/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query-encoded.js +0 -8
- package/dist/targets/node/fetch/fixtures/query.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/query.js +0 -8
- package/dist/targets/node/fetch/fixtures/short.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/short.js +0 -8
- package/dist/targets/node/fetch/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/fetch/fixtures/text-plain.js +0 -8
- package/dist/targets/node/native/client.d.ts +0 -11
- package/dist/targets/node/native/client.js +0 -72
- package/dist/targets/node/native/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-form-encoded.js +0 -24
- package/dist/targets/node/native/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/native/fixtures/application-json.js +0 -30
- package/dist/targets/node/native/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/native/fixtures/cookies.js +0 -22
- package/dist/targets/node/native/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/native/fixtures/custom-method.js +0 -20
- package/dist/targets/node/native/fixtures/full.d.ts +0 -1
- package/dist/targets/node/native/fixtures/full.js +0 -26
- package/dist/targets/node/native/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/native/fixtures/headers.js +0 -25
- package/dist/targets/node/native/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/native/fixtures/http-insecure.js +0 -20
- package/dist/targets/node/native/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-multiline.js +0 -23
- package/dist/targets/node/native/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/native/fixtures/jsonObj-null-value.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-data.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-file.js +0 -23
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data-no-params.js +0 -22
- package/dist/targets/node/native/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/native/fixtures/multipart-form-data.js +0 -23
- package/dist/targets/node/native/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/native/fixtures/nested.js +0 -20
- package/dist/targets/node/native/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/native/fixtures/postdata-malformed.js +0 -22
- package/dist/targets/node/native/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query-encoded.js +0 -20
- package/dist/targets/node/native/fixtures/query.d.ts +0 -1
- package/dist/targets/node/native/fixtures/query.js +0 -20
- package/dist/targets/node/native/fixtures/short.d.ts +0 -1
- package/dist/targets/node/native/fixtures/short.js +0 -20
- package/dist/targets/node/native/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/native/fixtures/text-plain.js +0 -23
- package/dist/targets/node/request/client.d.ts +0 -11
- package/dist/targets/node/request/client.js +0 -107
- package/dist/targets/node/request/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-form-encoded.js +0 -13
- package/dist/targets/node/request/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/request/fixtures/application-json.js +0 -21
- package/dist/targets/node/request/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/request/fixtures/cookies.js +0 -11
- package/dist/targets/node/request/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/request/fixtures/custom-method.js +0 -8
- package/dist/targets/node/request/fixtures/full.d.ts +0 -1
- package/dist/targets/node/request/fixtures/full.js +0 -20
- package/dist/targets/node/request/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/request/fixtures/headers.js +0 -17
- package/dist/targets/node/request/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/request/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/request/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-multiline.js +0 -14
- package/dist/targets/node/request/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/request/fixtures/jsonObj-null-value.js +0 -14
- package/dist/targets/node/request/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/request/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-file.js +0 -19
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data-no-params.js +0 -12
- package/dist/targets/node/request/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/request/fixtures/multipart-form-data.js +0 -13
- package/dist/targets/node/request/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/request/fixtures/nested.js +0 -11
- package/dist/targets/node/request/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/request/fixtures/postdata-malformed.js +0 -12
- package/dist/targets/node/request/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query-encoded.js +0 -11
- package/dist/targets/node/request/fixtures/query.d.ts +0 -1
- package/dist/targets/node/request/fixtures/query.js +0 -11
- package/dist/targets/node/request/fixtures/short.d.ts +0 -1
- package/dist/targets/node/request/fixtures/short.js +0 -8
- package/dist/targets/node/request/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/request/fixtures/text-plain.js +0 -13
- package/dist/targets/node/target.d.ts +0 -2
- package/dist/targets/node/target.js +0 -24
- package/dist/targets/node/unirest/client.d.ts +0 -11
- package/dist/targets/node/unirest/client.js +0 -110
- package/dist/targets/node/unirest/fixtures/application-form-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-form-encoded.js +0 -15
- package/dist/targets/node/unirest/fixtures/application-json.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/application-json.js +0 -32
- package/dist/targets/node/unirest/fixtures/cookies.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/cookies.js +0 -12
- package/dist/targets/node/unirest/fixtures/custom-method.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/custom-method.js +0 -8
- package/dist/targets/node/unirest/fixtures/full.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/full.js +0 -27
- package/dist/targets/node/unirest/fixtures/headers.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/headers.js +0 -14
- package/dist/targets/node/unirest/fixtures/http-insecure.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/http-insecure.js +0 -8
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-multiline.js +0 -15
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/jsonObj-null-value.js +0 -15
- package/dist/targets/node/unirest/fixtures/multipart-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-data.js +0 -20
- package/dist/targets/node/unirest/fixtures/multipart-file.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-file.js +0 -18
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data-no-params.js +0 -11
- package/dist/targets/node/unirest/fixtures/multipart-form-data.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/multipart-form-data.js +0 -16
- package/dist/targets/node/unirest/fixtures/nested.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/nested.js +0 -13
- package/dist/targets/node/unirest/fixtures/postdata-malformed.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/postdata-malformed.js +0 -11
- package/dist/targets/node/unirest/fixtures/query-encoded.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query-encoded.js +0 -12
- package/dist/targets/node/unirest/fixtures/query.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/query.js +0 -16
- package/dist/targets/node/unirest/fixtures/short.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/short.js +0 -8
- package/dist/targets/node/unirest/fixtures/text-plain.d.ts +0 -1
- package/dist/targets/node/unirest/fixtures/text-plain.js +0 -12
- package/dist/targets/objc/helpers.d.ts +0 -26
- package/dist/targets/objc/helpers.js +0 -59
- package/dist/targets/objc/nsurlsession/client.d.ts +0 -15
- package/dist/targets/objc/nsurlsession/client.js +0 -143
- package/dist/targets/objc/target.d.ts +0 -2
- package/dist/targets/objc/target.js +0 -15
- package/dist/targets/ocaml/cohttp/client.d.ts +0 -11
- package/dist/targets/ocaml/cohttp/client.js +0 -64
- package/dist/targets/ocaml/target.d.ts +0 -2
- package/dist/targets/ocaml/target.js +0 -15
- package/dist/targets/php/curl/client.d.ts +0 -19
- package/dist/targets/php/curl/client.js +0 -122
- package/dist/targets/php/guzzle/client.d.ts +0 -17
- package/dist/targets/php/guzzle/client.js +0 -119
- package/dist/targets/php/helpers.d.ts +0 -2
- package/dist/targets/php/helpers.js +0 -66
- package/dist/targets/php/http1/client.d.ts +0 -16
- package/dist/targets/php/http1/client.js +0 -76
- package/dist/targets/php/http2/client.d.ts +0 -16
- package/dist/targets/php/http2/client.js +0 -115
- package/dist/targets/php/target.d.ts +0 -2
- package/dist/targets/php/target.js +0 -22
- package/dist/targets/powershell/common.d.ts +0 -3
- package/dist/targets/powershell/common.js +0 -50
- package/dist/targets/powershell/restmethod/client.d.ts +0 -2
- package/dist/targets/powershell/restmethod/client.js +0 -13
- package/dist/targets/powershell/target.d.ts +0 -2
- package/dist/targets/powershell/target.js +0 -17
- package/dist/targets/powershell/webrequest/client.d.ts +0 -2
- package/dist/targets/powershell/webrequest/client.js +0 -13
- package/dist/targets/python/helpers.d.ts +0 -8
- package/dist/targets/python/helpers.js +0 -64
- package/dist/targets/python/requests/client.d.ts +0 -14
- package/dist/targets/python/requests/client.js +0 -162
- package/dist/targets/python/target.d.ts +0 -2
- package/dist/targets/python/target.js +0 -16
- package/dist/targets/r/httr/client.d.ts +0 -11
- package/dist/targets/r/httr/client.js +0 -130
- package/dist/targets/r/target.d.ts +0 -2
- package/dist/targets/r/target.js +0 -15
- package/dist/targets/ruby/native/client.d.ts +0 -2
- package/dist/targets/ruby/native/client.js +0 -67
- package/dist/targets/ruby/target.d.ts +0 -2
- package/dist/targets/ruby/target.js +0 -15
- package/dist/targets/shell/curl/client.d.ts +0 -19
- package/dist/targets/shell/curl/client.js +0 -166
- package/dist/targets/shell/httpie/client.d.ts +0 -24
- package/dist/targets/shell/httpie/client.js +0 -102
- package/dist/targets/shell/target.d.ts +0 -2
- package/dist/targets/shell/target.js +0 -20
- package/dist/targets/shell/wget/client.d.ts +0 -16
- package/dist/targets/shell/wget/client.js +0 -46
- package/dist/targets/swift/helpers.d.ts +0 -16
- package/dist/targets/swift/helpers.js +0 -80
- package/dist/targets/swift/nsurlsession/client.d.ts +0 -15
- package/dist/targets/swift/nsurlsession/client.js +0 -148
- package/dist/targets/swift/target.d.ts +0 -2
- package/dist/targets/swift/target.js +0 -15
|
@@ -1,64 +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.cohttp = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
exports.cohttp = {
|
|
18
|
-
info: {
|
|
19
|
-
key: 'cohttp',
|
|
20
|
-
title: 'CoHTTP',
|
|
21
|
-
link: 'https://github.com/mirage/ocaml-cohttp',
|
|
22
|
-
description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml',
|
|
23
|
-
},
|
|
24
|
-
convert: function (_a, options) {
|
|
25
|
-
var fullUrl = _a.fullUrl, allHeaders = _a.allHeaders, postData = _a.postData, method = _a.method;
|
|
26
|
-
var opts = __assign({ indent: ' ' }, options);
|
|
27
|
-
var methods = ['get', 'post', 'head', 'delete', 'patch', 'put', 'options'];
|
|
28
|
-
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _b.push, blank = _b.blank, join = _b.join;
|
|
29
|
-
push('open Cohttp_lwt_unix');
|
|
30
|
-
push('open Cohttp');
|
|
31
|
-
push('open Lwt');
|
|
32
|
-
blank();
|
|
33
|
-
push("let uri = Uri.of_string \"".concat(fullUrl, "\" in"));
|
|
34
|
-
// Add headers, including the cookies
|
|
35
|
-
var headers = Object.keys(allHeaders);
|
|
36
|
-
if (headers.length === 1) {
|
|
37
|
-
push("let headers = Header.add (Header.init ()) \"".concat(headers[0], "\" \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[headers[0]]), "\" in"));
|
|
38
|
-
}
|
|
39
|
-
else if (headers.length > 1) {
|
|
40
|
-
push('let headers = Header.add_list (Header.init ()) [');
|
|
41
|
-
headers.forEach(function (key) {
|
|
42
|
-
push("(\"".concat(key, "\", \"").concat((0, escape_1.escapeForDoubleQuotes)(allHeaders[key]), "\");"), 1);
|
|
43
|
-
});
|
|
44
|
-
push('] in');
|
|
45
|
-
}
|
|
46
|
-
// Add body
|
|
47
|
-
if (postData.text) {
|
|
48
|
-
// Just text
|
|
49
|
-
push("let body = Cohttp_lwt_body.of_string ".concat(JSON.stringify(postData.text), " in"));
|
|
50
|
-
}
|
|
51
|
-
// Do the request
|
|
52
|
-
blank();
|
|
53
|
-
var h = headers.length ? '~headers ' : '';
|
|
54
|
-
var b = postData.text ? '~body ' : '';
|
|
55
|
-
var m = methods.includes(method.toLowerCase())
|
|
56
|
-
? "`".concat(method.toUpperCase())
|
|
57
|
-
: "(Code.method_of_string \"".concat(method, "\")");
|
|
58
|
-
push("Client.call ".concat(h).concat(b).concat(m, " uri"));
|
|
59
|
-
// Catch result
|
|
60
|
-
push('>>= fun (res, body_stream) ->');
|
|
61
|
-
push('(* Do stuff with the result *)', 1);
|
|
62
|
-
return join();
|
|
63
|
-
},
|
|
64
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ocaml = void 0;
|
|
4
|
-
var client_1 = require("./cohttp/client");
|
|
5
|
-
exports.ocaml = {
|
|
6
|
-
info: {
|
|
7
|
-
key: 'ocaml',
|
|
8
|
-
title: 'OCaml',
|
|
9
|
-
extname: '.ml',
|
|
10
|
-
default: 'cohttp',
|
|
11
|
-
},
|
|
12
|
-
clientsById: {
|
|
13
|
-
cohttp: client_1.cohttp,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @AhmadNassri
|
|
7
|
-
*
|
|
8
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '../../targets';
|
|
11
|
-
export interface CurlOptions {
|
|
12
|
-
closingTag?: boolean;
|
|
13
|
-
maxRedirects?: number;
|
|
14
|
-
namedErrors?: boolean;
|
|
15
|
-
noTags?: boolean;
|
|
16
|
-
shortTags?: boolean;
|
|
17
|
-
timeout?: number;
|
|
18
|
-
}
|
|
19
|
-
export declare const curl: Client<CurlOptions>;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.curl = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var escape_1 = require("../../../helpers/escape");
|
|
6
|
-
var helpers_1 = require("../helpers");
|
|
7
|
-
exports.curl = {
|
|
8
|
-
info: {
|
|
9
|
-
key: 'curl',
|
|
10
|
-
title: 'cURL',
|
|
11
|
-
link: 'http://php.net/manual/en/book.curl.php',
|
|
12
|
-
description: 'PHP with ext-curl',
|
|
13
|
-
},
|
|
14
|
-
convert: function (_a, options) {
|
|
15
|
-
var uriObj = _a.uriObj, postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method, httpVersion = _a.httpVersion, cookies = _a.cookies, headersObj = _a.headersObj;
|
|
16
|
-
if (options === void 0) { options = {}; }
|
|
17
|
-
var _b = options.closingTag, closingTag = _b === void 0 ? false : _b, _c = options.indent, indent = _c === void 0 ? ' ' : _c, _d = options.maxRedirects, maxRedirects = _d === void 0 ? 10 : _d, _e = options.namedErrors, namedErrors = _e === void 0 ? false : _e, _f = options.noTags, noTags = _f === void 0 ? false : _f, _g = options.shortTags, shortTags = _g === void 0 ? false : _g, _h = options.timeout, timeout = _h === void 0 ? 30 : _h;
|
|
18
|
-
var _j = new code_builder_1.CodeBuilder({ indent: indent }), push = _j.push, blank = _j.blank, join = _j.join;
|
|
19
|
-
if (!noTags) {
|
|
20
|
-
push(shortTags ? '<?' : '<?php');
|
|
21
|
-
blank();
|
|
22
|
-
}
|
|
23
|
-
push('$curl = curl_init();');
|
|
24
|
-
blank();
|
|
25
|
-
var curlOptions = [
|
|
26
|
-
{
|
|
27
|
-
escape: true,
|
|
28
|
-
name: 'CURLOPT_PORT',
|
|
29
|
-
value: uriObj.port,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
escape: true,
|
|
33
|
-
name: 'CURLOPT_URL',
|
|
34
|
-
value: fullUrl,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
escape: false,
|
|
38
|
-
name: 'CURLOPT_RETURNTRANSFER',
|
|
39
|
-
value: 'true',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
escape: true,
|
|
43
|
-
name: 'CURLOPT_ENCODING',
|
|
44
|
-
value: '',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
escape: false,
|
|
48
|
-
name: 'CURLOPT_MAXREDIRS',
|
|
49
|
-
value: maxRedirects,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
escape: false,
|
|
53
|
-
name: 'CURLOPT_TIMEOUT',
|
|
54
|
-
value: timeout,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
escape: false,
|
|
58
|
-
name: 'CURLOPT_HTTP_VERSION',
|
|
59
|
-
value: httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
escape: true,
|
|
63
|
-
name: 'CURLOPT_CUSTOMREQUEST',
|
|
64
|
-
value: method,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
escape: !postData.jsonObj,
|
|
68
|
-
name: 'CURLOPT_POSTFIELDS',
|
|
69
|
-
value: postData
|
|
70
|
-
? postData.jsonObj
|
|
71
|
-
? "json_encode(".concat((0, helpers_1.convertType)(postData.jsonObj, indent.repeat(2), indent), ")")
|
|
72
|
-
: postData.text
|
|
73
|
-
: undefined,
|
|
74
|
-
},
|
|
75
|
-
];
|
|
76
|
-
push('curl_setopt_array($curl, [');
|
|
77
|
-
var curlopts = new code_builder_1.CodeBuilder({ indent: indent, join: "\n".concat(indent) });
|
|
78
|
-
curlOptions.forEach(function (_a) {
|
|
79
|
-
var value = _a.value, name = _a.name, escape = _a.escape;
|
|
80
|
-
if (value !== null && value !== undefined) {
|
|
81
|
-
curlopts.push("".concat(name, " => ").concat(escape ? JSON.stringify(value) : value, ","));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// construct cookies
|
|
85
|
-
var curlCookies = cookies.map(function (cookie) { return "".concat(encodeURIComponent(cookie.name), "=").concat(encodeURIComponent(cookie.value)); });
|
|
86
|
-
if (curlCookies.length) {
|
|
87
|
-
curlopts.push("CURLOPT_COOKIE => \"".concat(curlCookies.join('; '), "\","));
|
|
88
|
-
}
|
|
89
|
-
// construct cookies
|
|
90
|
-
var headers = Object.keys(headersObj)
|
|
91
|
-
.sort()
|
|
92
|
-
.map(function (key) { return "\"".concat(key, ": ").concat((0, escape_1.escapeForDoubleQuotes)(headersObj[key]), "\""); });
|
|
93
|
-
if (headers.length) {
|
|
94
|
-
curlopts.push('CURLOPT_HTTPHEADER => [');
|
|
95
|
-
curlopts.push(headers.join(",\n".concat(indent).concat(indent)), 1);
|
|
96
|
-
curlopts.push('],');
|
|
97
|
-
}
|
|
98
|
-
push(curlopts.join(), 1);
|
|
99
|
-
push(']);');
|
|
100
|
-
blank();
|
|
101
|
-
push('$response = curl_exec($curl);');
|
|
102
|
-
push('$err = curl_error($curl);');
|
|
103
|
-
blank();
|
|
104
|
-
push('curl_close($curl);');
|
|
105
|
-
blank();
|
|
106
|
-
push('if ($err) {');
|
|
107
|
-
if (namedErrors) {
|
|
108
|
-
push('echo array_flip(get_defined_constants(true)["curl"])[$err];', 1);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
push('echo "cURL Error #:" . $err;', 1);
|
|
112
|
-
}
|
|
113
|
-
push('} else {');
|
|
114
|
-
push('echo $response;', 1);
|
|
115
|
-
push('}');
|
|
116
|
-
if (!noTags && closingTag) {
|
|
117
|
-
blank();
|
|
118
|
-
push('?>');
|
|
119
|
-
}
|
|
120
|
-
return join();
|
|
121
|
-
},
|
|
122
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for PHP using Guzzle.
|
|
4
|
-
*
|
|
5
|
-
* @author @RobertoArruda
|
|
6
|
-
* @author @erunion
|
|
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 GuzzleOptions {
|
|
12
|
-
closingTag?: boolean;
|
|
13
|
-
indent?: string;
|
|
14
|
-
noTags?: boolean;
|
|
15
|
-
shortTags?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare const guzzle: Client<GuzzleOptions>;
|
|
@@ -1,119 +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.guzzle = void 0;
|
|
15
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
|
-
var escape_1 = require("../../../helpers/escape");
|
|
17
|
-
var headers_1 = require("../../../helpers/headers");
|
|
18
|
-
var helpers_1 = require("../helpers");
|
|
19
|
-
exports.guzzle = {
|
|
20
|
-
info: {
|
|
21
|
-
key: 'guzzle',
|
|
22
|
-
title: 'Guzzle',
|
|
23
|
-
link: 'http://docs.guzzlephp.org/en/stable/',
|
|
24
|
-
description: 'PHP with Guzzle',
|
|
25
|
-
},
|
|
26
|
-
convert: function (_a, options) {
|
|
27
|
-
var _b;
|
|
28
|
-
var postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method, cookies = _a.cookies, headersObj = _a.headersObj;
|
|
29
|
-
var opts = __assign({ closingTag: false, indent: ' ', noTags: false, shortTags: false }, options);
|
|
30
|
-
var _c = new code_builder_1.CodeBuilder({ indent: opts.indent }), push = _c.push, blank = _c.blank, join = _c.join;
|
|
31
|
-
var _d = new code_builder_1.CodeBuilder({ indent: opts.indent }), requestCode = _d.code, requestPush = _d.push, requestJoin = _d.join;
|
|
32
|
-
if (!opts.noTags) {
|
|
33
|
-
push(opts.shortTags ? '<?' : '<?php');
|
|
34
|
-
}
|
|
35
|
-
push("require_once('vendor/autoload.php');");
|
|
36
|
-
blank();
|
|
37
|
-
switch (postData.mimeType) {
|
|
38
|
-
case 'application/x-www-form-urlencoded':
|
|
39
|
-
requestPush("'form_params' => ".concat((0, helpers_1.convertType)(postData.paramsObj, opts.indent + opts.indent, opts.indent), ","), 1);
|
|
40
|
-
break;
|
|
41
|
-
case 'multipart/form-data': {
|
|
42
|
-
var fields_1 = [];
|
|
43
|
-
if (postData.params) {
|
|
44
|
-
postData.params.forEach(function (param) {
|
|
45
|
-
if (param.fileName) {
|
|
46
|
-
var field = {
|
|
47
|
-
name: param.name,
|
|
48
|
-
filename: param.fileName,
|
|
49
|
-
contents: param.value,
|
|
50
|
-
};
|
|
51
|
-
if (param.contentType) {
|
|
52
|
-
field.headers = { 'Content-Type': param.contentType };
|
|
53
|
-
}
|
|
54
|
-
fields_1.push(field);
|
|
55
|
-
}
|
|
56
|
-
else if (param.value) {
|
|
57
|
-
fields_1.push({
|
|
58
|
-
name: param.name,
|
|
59
|
-
contents: param.value,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (fields_1.length) {
|
|
65
|
-
requestPush("'multipart' => ".concat((0, helpers_1.convertType)(fields_1, opts.indent + opts.indent, opts.indent)), 1);
|
|
66
|
-
// Guzzle adds its own boundary for multipart requests.
|
|
67
|
-
if ((0, headers_1.hasHeader)(headersObj, 'content-type')) {
|
|
68
|
-
if ((_b = (0, headers_1.getHeader)(headersObj, 'content-type')) === null || _b === void 0 ? void 0 : _b.indexOf('boundary')) {
|
|
69
|
-
var headerName = (0, headers_1.getHeaderName)(headersObj, 'content-type');
|
|
70
|
-
if (headerName) {
|
|
71
|
-
delete headersObj[headerName];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
default:
|
|
79
|
-
if (postData.text) {
|
|
80
|
-
requestPush("'body' => ".concat((0, helpers_1.convertType)(postData.text), ","), 1);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// construct headers
|
|
84
|
-
var headers = Object.keys(headersObj)
|
|
85
|
-
.sort()
|
|
86
|
-
.map(function (key) {
|
|
87
|
-
return "".concat(opts.indent).concat(opts.indent, "'").concat(key, "' => '").concat((0, escape_1.escapeForSingleQuotes)(headersObj[key]), "',");
|
|
88
|
-
});
|
|
89
|
-
// construct cookies
|
|
90
|
-
var cookieString = cookies
|
|
91
|
-
.map(function (cookie) { return "".concat(encodeURIComponent(cookie.name), "=").concat(encodeURIComponent(cookie.value)); })
|
|
92
|
-
.join('; ');
|
|
93
|
-
if (cookieString.length) {
|
|
94
|
-
headers.push("".concat(opts.indent).concat(opts.indent, "'cookie' => '").concat((0, escape_1.escapeForSingleQuotes)(cookieString), "',"));
|
|
95
|
-
}
|
|
96
|
-
if (headers.length) {
|
|
97
|
-
requestPush("'headers' => [", 1);
|
|
98
|
-
requestPush(headers.join('\n'));
|
|
99
|
-
requestPush('],', 1);
|
|
100
|
-
}
|
|
101
|
-
push('$client = new \\GuzzleHttp\\Client();');
|
|
102
|
-
blank();
|
|
103
|
-
if (requestCode.length) {
|
|
104
|
-
push("$response = $client->request('".concat(method, "', '").concat(fullUrl, "', ["));
|
|
105
|
-
push(requestJoin());
|
|
106
|
-
push(']);');
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
push("$response = $client->request('".concat(method, "', '").concat(fullUrl, "');"));
|
|
110
|
-
}
|
|
111
|
-
blank();
|
|
112
|
-
push('echo $response->getBody();');
|
|
113
|
-
if (!opts.noTags && opts.closingTag) {
|
|
114
|
-
blank();
|
|
115
|
-
push('?>');
|
|
116
|
-
}
|
|
117
|
-
return join();
|
|
118
|
-
},
|
|
119
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportedMethods = exports.convertType = void 0;
|
|
4
|
-
var escape_1 = require("../../helpers/escape");
|
|
5
|
-
var convertType = function (obj, indent, lastIndent) {
|
|
6
|
-
lastIndent = lastIndent || '';
|
|
7
|
-
indent = indent || '';
|
|
8
|
-
switch (Object.prototype.toString.call(obj)) {
|
|
9
|
-
case '[object Boolean]':
|
|
10
|
-
return obj;
|
|
11
|
-
case '[object Null]':
|
|
12
|
-
return 'null';
|
|
13
|
-
case '[object Undefined]':
|
|
14
|
-
return 'null';
|
|
15
|
-
case '[object String]':
|
|
16
|
-
return "'".concat((0, escape_1.escapeString)(obj, { delimiter: "'", escapeNewlines: false }), "'");
|
|
17
|
-
case '[object Number]':
|
|
18
|
-
return obj.toString();
|
|
19
|
-
case '[object Array]': {
|
|
20
|
-
var contents = obj.map(function (item) { return (0, exports.convertType)(item, "".concat(indent).concat(indent), indent); }).join(",\n".concat(indent));
|
|
21
|
-
return "[\n".concat(indent).concat(contents, "\n").concat(lastIndent, "]");
|
|
22
|
-
}
|
|
23
|
-
case '[object Object]': {
|
|
24
|
-
var result = [];
|
|
25
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
26
|
-
for (var i in obj) {
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
28
|
-
result.push("".concat((0, exports.convertType)(i, indent), " => ").concat((0, exports.convertType)(obj[i], "".concat(indent).concat(indent), indent)));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return "[\n".concat(indent).concat(result.join(",\n".concat(indent)), "\n").concat(lastIndent, "]");
|
|
32
|
-
}
|
|
33
|
-
default:
|
|
34
|
-
return 'null';
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.convertType = convertType;
|
|
38
|
-
exports.supportedMethods = [
|
|
39
|
-
'ACL',
|
|
40
|
-
'BASELINE_CONTROL',
|
|
41
|
-
'CHECKIN',
|
|
42
|
-
'CHECKOUT',
|
|
43
|
-
'CONNECT',
|
|
44
|
-
'COPY',
|
|
45
|
-
'DELETE',
|
|
46
|
-
'GET',
|
|
47
|
-
'HEAD',
|
|
48
|
-
'LABEL',
|
|
49
|
-
'LOCK',
|
|
50
|
-
'MERGE',
|
|
51
|
-
'MKACTIVITY',
|
|
52
|
-
'MKCOL',
|
|
53
|
-
'MKWORKSPACE',
|
|
54
|
-
'MOVE',
|
|
55
|
-
'OPTIONS',
|
|
56
|
-
'POST',
|
|
57
|
-
'PROPFIND',
|
|
58
|
-
'PROPPATCH',
|
|
59
|
-
'PUT',
|
|
60
|
-
'REPORT',
|
|
61
|
-
'TRACE',
|
|
62
|
-
'UNCHECKOUT',
|
|
63
|
-
'UNLOCK',
|
|
64
|
-
'UPDATE',
|
|
65
|
-
'VERSION_CONTROL',
|
|
66
|
-
];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @AhmadNassri
|
|
7
|
-
*
|
|
8
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '../../targets';
|
|
11
|
-
export interface Http1Options {
|
|
12
|
-
closingTag?: boolean;
|
|
13
|
-
noTags?: boolean;
|
|
14
|
-
shortTags?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare const http1: Client<Http1Options>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.http1 = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var helpers_1 = require("../helpers");
|
|
6
|
-
exports.http1 = {
|
|
7
|
-
info: {
|
|
8
|
-
key: 'http1',
|
|
9
|
-
title: 'HTTP v1',
|
|
10
|
-
link: 'http://php.net/manual/en/book.http.php',
|
|
11
|
-
description: 'PHP with pecl/http v1',
|
|
12
|
-
},
|
|
13
|
-
convert: function (_a, options) {
|
|
14
|
-
var method = _a.method, url = _a.url, postData = _a.postData, queryObj = _a.queryObj, headersObj = _a.headersObj, cookiesObj = _a.cookiesObj;
|
|
15
|
-
if (options === void 0) { options = {}; }
|
|
16
|
-
var _b = options.closingTag, closingTag = _b === void 0 ? false : _b, _c = options.indent, indent = _c === void 0 ? ' ' : _c, _d = options.noTags, noTags = _d === void 0 ? false : _d, _e = options.shortTags, shortTags = _e === void 0 ? false : _e;
|
|
17
|
-
var _f = new code_builder_1.CodeBuilder({ indent: indent }), push = _f.push, blank = _f.blank, join = _f.join;
|
|
18
|
-
if (!noTags) {
|
|
19
|
-
push(shortTags ? '<?' : '<?php');
|
|
20
|
-
blank();
|
|
21
|
-
}
|
|
22
|
-
if (!helpers_1.supportedMethods.includes(method.toUpperCase())) {
|
|
23
|
-
push("HttpRequest::methodRegister('".concat(method, "');"));
|
|
24
|
-
}
|
|
25
|
-
push('$request = new HttpRequest();');
|
|
26
|
-
push("$request->setUrl(".concat((0, helpers_1.convertType)(url), ");"));
|
|
27
|
-
if (helpers_1.supportedMethods.includes(method.toUpperCase())) {
|
|
28
|
-
push("$request->setMethod(HTTP_METH_".concat(method.toUpperCase(), ");"));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
push("$request->setMethod(HttpRequest::HTTP_METH_".concat(method.toUpperCase(), ");"));
|
|
32
|
-
}
|
|
33
|
-
blank();
|
|
34
|
-
if (Object.keys(queryObj).length) {
|
|
35
|
-
push("$request->setQueryData(".concat((0, helpers_1.convertType)(queryObj, indent), ");"));
|
|
36
|
-
blank();
|
|
37
|
-
}
|
|
38
|
-
if (Object.keys(headersObj).length) {
|
|
39
|
-
push("$request->setHeaders(".concat((0, helpers_1.convertType)(headersObj, indent), ");"));
|
|
40
|
-
blank();
|
|
41
|
-
}
|
|
42
|
-
if (Object.keys(cookiesObj).length) {
|
|
43
|
-
push("$request->setCookies(".concat((0, helpers_1.convertType)(cookiesObj, indent), ");"));
|
|
44
|
-
blank();
|
|
45
|
-
}
|
|
46
|
-
switch (postData.mimeType) {
|
|
47
|
-
case 'application/x-www-form-urlencoded':
|
|
48
|
-
push("$request->setContentType(".concat((0, helpers_1.convertType)(postData.mimeType), ");"));
|
|
49
|
-
push("$request->setPostFields(".concat((0, helpers_1.convertType)(postData.paramsObj, indent), ");"));
|
|
50
|
-
blank();
|
|
51
|
-
break;
|
|
52
|
-
case 'application/json':
|
|
53
|
-
push("$request->setContentType(".concat((0, helpers_1.convertType)(postData.mimeType), ");"));
|
|
54
|
-
push("$request->setBody(json_encode(".concat((0, helpers_1.convertType)(postData.jsonObj, indent), "));"));
|
|
55
|
-
blank();
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
if (postData.text) {
|
|
59
|
-
push("$request->setBody(".concat((0, helpers_1.convertType)(postData.text), ");"));
|
|
60
|
-
blank();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
push('try {');
|
|
64
|
-
push('$response = $request->send();', 1);
|
|
65
|
-
blank();
|
|
66
|
-
push('echo $response->getBody();', 1);
|
|
67
|
-
push('} catch (HttpException $ex) {');
|
|
68
|
-
push('echo $ex;', 1);
|
|
69
|
-
push('}');
|
|
70
|
-
if (!noTags && closingTag) {
|
|
71
|
-
blank();
|
|
72
|
-
push('?>');
|
|
73
|
-
}
|
|
74
|
-
return join();
|
|
75
|
-
},
|
|
76
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
4
|
-
*
|
|
5
|
-
* @author
|
|
6
|
-
* @AhmadNassri
|
|
7
|
-
*
|
|
8
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '../../targets';
|
|
11
|
-
export interface Http2Options {
|
|
12
|
-
closingTag?: boolean;
|
|
13
|
-
noTags?: boolean;
|
|
14
|
-
shortTags?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare const http2: Client<Http2Options>;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.http2 = void 0;
|
|
4
|
-
var code_builder_1 = require("../../../helpers/code-builder");
|
|
5
|
-
var headers_1 = require("../../../helpers/headers");
|
|
6
|
-
var helpers_1 = require("../helpers");
|
|
7
|
-
exports.http2 = {
|
|
8
|
-
info: {
|
|
9
|
-
key: 'http2',
|
|
10
|
-
title: 'HTTP v2',
|
|
11
|
-
link: 'http://devel-m6w6.rhcloud.com/mdref/http',
|
|
12
|
-
description: 'PHP with pecl/http v2',
|
|
13
|
-
},
|
|
14
|
-
convert: function (_a, options) {
|
|
15
|
-
var _b;
|
|
16
|
-
var postData = _a.postData, headersObj = _a.headersObj, method = _a.method, queryObj = _a.queryObj, cookiesObj = _a.cookiesObj, url = _a.url;
|
|
17
|
-
if (options === void 0) { options = {}; }
|
|
18
|
-
var _c = options.closingTag, closingTag = _c === void 0 ? false : _c, _d = options.indent, indent = _d === void 0 ? ' ' : _d, _e = options.noTags, noTags = _e === void 0 ? false : _e, _f = options.shortTags, shortTags = _f === void 0 ? false : _f;
|
|
19
|
-
var _g = new code_builder_1.CodeBuilder({ indent: indent }), push = _g.push, blank = _g.blank, join = _g.join;
|
|
20
|
-
var hasBody = false;
|
|
21
|
-
if (!noTags) {
|
|
22
|
-
push(shortTags ? '<?' : '<?php');
|
|
23
|
-
blank();
|
|
24
|
-
}
|
|
25
|
-
push('$client = new http\\Client;');
|
|
26
|
-
push('$request = new http\\Client\\Request;');
|
|
27
|
-
blank();
|
|
28
|
-
switch (postData.mimeType) {
|
|
29
|
-
case 'application/x-www-form-urlencoded':
|
|
30
|
-
push('$body = new http\\Message\\Body;');
|
|
31
|
-
push("$body->append(new http\\QueryString(".concat((0, helpers_1.convertType)(postData.paramsObj, indent), "));"));
|
|
32
|
-
blank();
|
|
33
|
-
hasBody = true;
|
|
34
|
-
break;
|
|
35
|
-
case 'multipart/form-data': {
|
|
36
|
-
if (!postData.params) {
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
var files_1 = [];
|
|
40
|
-
var fields_1 = {};
|
|
41
|
-
postData.params.forEach(function (_a) {
|
|
42
|
-
var name = _a.name, fileName = _a.fileName, value = _a.value, contentType = _a.contentType;
|
|
43
|
-
if (fileName) {
|
|
44
|
-
files_1.push({
|
|
45
|
-
name: name,
|
|
46
|
-
type: contentType,
|
|
47
|
-
file: fileName,
|
|
48
|
-
data: value,
|
|
49
|
-
});
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (value) {
|
|
53
|
-
fields_1[name] = value;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
var field = Object.keys(fields_1).length ? (0, helpers_1.convertType)(fields_1, indent) : 'null';
|
|
57
|
-
var formValue = files_1.length ? (0, helpers_1.convertType)(files_1, indent) : 'null';
|
|
58
|
-
push('$body = new http\\Message\\Body;');
|
|
59
|
-
push("$body->addForm(".concat(field, ", ").concat(formValue, ");"));
|
|
60
|
-
// remove the contentType header
|
|
61
|
-
if ((0, headers_1.hasHeader)(headersObj, 'content-type')) {
|
|
62
|
-
if ((_b = (0, headers_1.getHeader)(headersObj, 'content-type')) === null || _b === void 0 ? void 0 : _b.indexOf('boundary')) {
|
|
63
|
-
var headerName = (0, headers_1.getHeaderName)(headersObj, 'content-type');
|
|
64
|
-
if (headerName) {
|
|
65
|
-
delete headersObj[headerName];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
blank();
|
|
70
|
-
hasBody = true;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case 'application/json':
|
|
74
|
-
push('$body = new http\\Message\\Body;');
|
|
75
|
-
push("$body->append(json_encode(".concat((0, helpers_1.convertType)(postData.jsonObj, indent), "));"));
|
|
76
|
-
hasBody = true;
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
if (postData.text) {
|
|
80
|
-
push('$body = new http\\Message\\Body;');
|
|
81
|
-
push("$body->append(".concat((0, helpers_1.convertType)(postData.text), ");"));
|
|
82
|
-
blank();
|
|
83
|
-
hasBody = true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
push("$request->setRequestUrl(".concat((0, helpers_1.convertType)(url), ");"));
|
|
87
|
-
push("$request->setRequestMethod(".concat((0, helpers_1.convertType)(method), ");"));
|
|
88
|
-
if (hasBody) {
|
|
89
|
-
push('$request->setBody($body);');
|
|
90
|
-
blank();
|
|
91
|
-
}
|
|
92
|
-
if (Object.keys(queryObj).length) {
|
|
93
|
-
push("$request->setQuery(new http\\QueryString(".concat((0, helpers_1.convertType)(queryObj, indent), "));"));
|
|
94
|
-
blank();
|
|
95
|
-
}
|
|
96
|
-
if (Object.keys(headersObj).length) {
|
|
97
|
-
push("$request->setHeaders(".concat((0, helpers_1.convertType)(headersObj, indent), ");"));
|
|
98
|
-
blank();
|
|
99
|
-
}
|
|
100
|
-
if (Object.keys(cookiesObj).length) {
|
|
101
|
-
blank();
|
|
102
|
-
push("$client->setCookies(".concat((0, helpers_1.convertType)(cookiesObj, indent), ");"));
|
|
103
|
-
blank();
|
|
104
|
-
}
|
|
105
|
-
push('$client->enqueue($request)->send();');
|
|
106
|
-
push('$response = $client->getResponse();');
|
|
107
|
-
blank();
|
|
108
|
-
push('echo $response->getBody();');
|
|
109
|
-
if (!noTags && closingTag) {
|
|
110
|
-
blank();
|
|
111
|
-
push('?>');
|
|
112
|
-
}
|
|
113
|
-
return join();
|
|
114
|
-
},
|
|
115
|
-
};
|