├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github └── workflows │ ├── build.yml │ ├── release.yml │ └── sast.yml ├── .gitignore ├── .markdownlint.yaml ├── .npmignore ├── .nvmrc ├── .prettierignore ├── .prettierrc.js ├── .vscode ├── extensions.json └── settings.json ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── bin └── httpsnippet ├── docker-compose.yml ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── cli.ts ├── fixtures │ ├── customTarget.ts │ ├── mimetypes.ts │ ├── requests │ │ ├── application-form-encoded.json │ │ ├── application-json.json │ │ ├── cookies.json │ │ ├── custom-method.json │ │ ├── full.json │ │ ├── headers.json │ │ ├── https.json │ │ ├── jsonObj-multiline.json │ │ ├── jsonObj-null-value.json │ │ ├── multipart-data.json │ │ ├── multipart-file.json │ │ ├── multipart-form-data-no-params.json │ │ ├── multipart-form-data.json │ │ ├── nested.json │ │ ├── query.json │ │ ├── short.json │ │ └── text-plain.json │ └── runCustomFixtures.ts ├── helpers │ ├── __snapshots__ │ │ └── utils.test.ts.snap │ ├── code-builder.test.ts │ ├── code-builder.ts │ ├── escape.test.ts │ ├── escape.ts │ ├── form-data.ts │ ├── headers.test.ts │ ├── headers.ts │ ├── reducer.test.ts │ ├── reducer.ts │ ├── shell.ts │ ├── utils.test.ts │ └── utils.ts ├── httpsnippet.test.ts ├── httpsnippet.ts ├── index.ts ├── targets │ ├── c │ │ ├── libcurl │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.c │ │ │ │ ├── application-json.c │ │ │ │ ├── cookies.c │ │ │ │ ├── custom-method.c │ │ │ │ ├── full.c │ │ │ │ ├── headers.c │ │ │ │ ├── https.c │ │ │ │ ├── jsonObj-multiline.c │ │ │ │ ├── jsonObj-null-value.c │ │ │ │ ├── multipart-data.c │ │ │ │ ├── multipart-file.c │ │ │ │ ├── multipart-form-data-no-params.c │ │ │ │ ├── multipart-form-data.c │ │ │ │ ├── nested.c │ │ │ │ ├── query.c │ │ │ │ ├── short.c │ │ │ │ └── text-plain.c │ │ └── target.ts │ ├── clojure │ │ ├── clj_http │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.clj │ │ │ │ ├── application-json.clj │ │ │ │ ├── cookies.clj │ │ │ │ ├── custom-method.clj │ │ │ │ ├── full.clj │ │ │ │ ├── headers.clj │ │ │ │ ├── https.clj │ │ │ │ ├── jsonObj-multiline.clj │ │ │ │ ├── jsonObj-null-value.clj │ │ │ │ ├── multipart-data.clj │ │ │ │ ├── multipart-file.clj │ │ │ │ ├── multipart-form-data-no-params.clj │ │ │ │ ├── multipart-form-data.clj │ │ │ │ ├── nested.clj │ │ │ │ ├── query.clj │ │ │ │ ├── short.clj │ │ │ │ └── text-plain.clj │ │ └── target.ts │ ├── crystal │ │ ├── native │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.cr │ │ │ │ ├── application-json.cr │ │ │ │ ├── cookies.cr │ │ │ │ ├── custom-method.cr │ │ │ │ ├── full.cr │ │ │ │ ├── headers.cr │ │ │ │ ├── https.cr │ │ │ │ ├── insecure-skip-verify.cr │ │ │ │ ├── jsonObj-multiline.cr │ │ │ │ ├── jsonObj-null-value.cr │ │ │ │ ├── multipart-data.cr │ │ │ │ ├── multipart-file.cr │ │ │ │ ├── multipart-form-data-no-params.cr │ │ │ │ ├── multipart-form-data.cr │ │ │ │ ├── nested.cr │ │ │ │ ├── query.cr │ │ │ │ ├── short.cr │ │ │ │ └── text-plain.cr │ │ └── target.ts │ ├── csharp │ │ ├── httpclient │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.cs │ │ │ │ ├── application-json.cs │ │ │ │ ├── cookies.cs │ │ │ │ ├── custom-method.cs │ │ │ │ ├── full.cs │ │ │ │ ├── headers.cs │ │ │ │ ├── https.cs │ │ │ │ ├── jsonObj-multiline.cs │ │ │ │ ├── jsonObj-null-value.cs │ │ │ │ ├── multipart-data.cs │ │ │ │ ├── multipart-file.cs │ │ │ │ ├── multipart-form-data-no-params.cs │ │ │ │ ├── multipart-form-data.cs │ │ │ │ ├── nested.cs │ │ │ │ ├── query.cs │ │ │ │ ├── short.cs │ │ │ │ └── text-plain.cs │ │ ├── restsharp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.cs │ │ │ │ ├── application-json.cs │ │ │ │ ├── cookies.cs │ │ │ │ ├── custom-method.cs │ │ │ │ ├── full.cs │ │ │ │ ├── headers.cs │ │ │ │ ├── https.cs │ │ │ │ ├── jsonObj-multiline.cs │ │ │ │ ├── jsonObj-null-value.cs │ │ │ │ ├── multipart-data.cs │ │ │ │ ├── multipart-file.cs │ │ │ │ ├── multipart-form-data-no-params.cs │ │ │ │ ├── multipart-form-data.cs │ │ │ │ ├── nested.cs │ │ │ │ ├── query.cs │ │ │ │ ├── short.cs │ │ │ │ └── text-plain.cs │ │ └── target.ts │ ├── go │ │ ├── native │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.go │ │ │ │ ├── application-json.go │ │ │ │ ├── boilerplate-option.go │ │ │ │ ├── check-errors-option.go │ │ │ │ ├── cookies.go │ │ │ │ ├── custom-method.go │ │ │ │ ├── full.go │ │ │ │ ├── headers.go │ │ │ │ ├── https.go │ │ │ │ ├── insecure-skip-verify.go │ │ │ │ ├── jsonObj-multiline.go │ │ │ │ ├── jsonObj-null-value.go │ │ │ │ ├── multipart-data.go │ │ │ │ ├── multipart-file.go │ │ │ │ ├── multipart-form-data-no-params.go │ │ │ │ ├── multipart-form-data.go │ │ │ │ ├── nested.go │ │ │ │ ├── print-body-option.go │ │ │ │ ├── query.go │ │ │ │ ├── short.go │ │ │ │ ├── text-plain.go │ │ │ │ └── timeout-option.go │ │ └── target.ts │ ├── http │ │ ├── http1.1 │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded │ │ │ │ ├── application-json │ │ │ │ ├── cookies │ │ │ │ ├── custom-method │ │ │ │ ├── full │ │ │ │ ├── headers │ │ │ │ ├── https │ │ │ │ ├── jsonObj-multiline │ │ │ │ ├── jsonObj-null-value │ │ │ │ ├── multipart-data │ │ │ │ ├── multipart-file │ │ │ │ ├── multipart-form-data │ │ │ │ ├── multipart-form-data-no-params │ │ │ │ ├── nested │ │ │ │ ├── query │ │ │ │ ├── short │ │ │ │ └── text-plain │ │ └── target.ts │ ├── java │ │ ├── asynchttp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.java │ │ │ │ ├── application-json.java │ │ │ │ ├── cookies.java │ │ │ │ ├── custom-method.java │ │ │ │ ├── full.java │ │ │ │ ├── headers.java │ │ │ │ ├── https.java │ │ │ │ ├── jsonObj-multiline.java │ │ │ │ ├── jsonObj-null-value.java │ │ │ │ ├── multipart-data.java │ │ │ │ ├── multipart-file.java │ │ │ │ ├── multipart-form-data-no-params.java │ │ │ │ ├── multipart-form-data.java │ │ │ │ ├── nested.java │ │ │ │ ├── query.java │ │ │ │ ├── short.java │ │ │ │ └── text-plain.java │ │ ├── nethttp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.java │ │ │ │ ├── application-json.java │ │ │ │ ├── cookies.java │ │ │ │ ├── custom-method.java │ │ │ │ ├── full.java │ │ │ │ ├── headers.java │ │ │ │ ├── https.java │ │ │ │ ├── jsonObj-multiline.java │ │ │ │ ├── jsonObj-null-value.java │ │ │ │ ├── multipart-data.java │ │ │ │ ├── multipart-file.java │ │ │ │ ├── multipart-form-data-no-params.java │ │ │ │ ├── multipart-form-data.java │ │ │ │ ├── nested.java │ │ │ │ ├── query.java │ │ │ │ ├── short.java │ │ │ │ └── text-plain.java │ │ ├── okhttp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.java │ │ │ │ ├── application-json.java │ │ │ │ ├── cookies.java │ │ │ │ ├── custom-method.java │ │ │ │ ├── full.java │ │ │ │ ├── headers.java │ │ │ │ ├── https.java │ │ │ │ ├── jsonObj-multiline.java │ │ │ │ ├── jsonObj-null-value.java │ │ │ │ ├── multipart-data.java │ │ │ │ ├── multipart-file.java │ │ │ │ ├── multipart-form-data-no-params.java │ │ │ │ ├── multipart-form-data.java │ │ │ │ ├── nested.java │ │ │ │ ├── query.java │ │ │ │ ├── short.java │ │ │ │ └── text-plain.java │ │ ├── target.ts │ │ └── unirest │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ ├── application-form-encoded.java │ │ │ ├── application-json.java │ │ │ ├── cookies.java │ │ │ ├── custom-method.java │ │ │ ├── full.java │ │ │ ├── headers.java │ │ │ ├── https.java │ │ │ ├── jsonObj-multiline.java │ │ │ ├── jsonObj-null-value.java │ │ │ ├── multipart-data.java │ │ │ ├── multipart-file.java │ │ │ ├── multipart-form-data-no-params.java │ │ │ ├── multipart-form-data.java │ │ │ ├── nested.java │ │ │ ├── query.java │ │ │ ├── short.java │ │ │ └── text-plain.java │ ├── javascript │ │ ├── axios │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── fetch │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── jquery │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── target.ts │ │ └── xhr │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ ├── application-form-encoded.js │ │ │ ├── application-json.js │ │ │ ├── cookies.js │ │ │ ├── cors.js │ │ │ ├── custom-method.js │ │ │ ├── full.js │ │ │ ├── headers.js │ │ │ ├── https.js │ │ │ ├── jsonObj-multiline.js │ │ │ ├── jsonObj-null-value.js │ │ │ ├── multipart-data.js │ │ │ ├── multipart-file.js │ │ │ ├── multipart-form-data-no-params.js │ │ │ ├── multipart-form-data.js │ │ │ ├── nested.js │ │ │ ├── query.js │ │ │ ├── short.js │ │ │ └── text-plain.js │ ├── kotlin │ │ ├── okhttp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.kt │ │ │ │ ├── application-json.kt │ │ │ │ ├── cookies.kt │ │ │ │ ├── custom-method.kt │ │ │ │ ├── full.kt │ │ │ │ ├── headers.kt │ │ │ │ ├── https.kt │ │ │ │ ├── jsonObj-multiline.kt │ │ │ │ ├── jsonObj-null-value.kt │ │ │ │ ├── multipart-data.kt │ │ │ │ ├── multipart-file.kt │ │ │ │ ├── multipart-form-data-no-params.kt │ │ │ │ ├── multipart-form-data.kt │ │ │ │ ├── nested.kt │ │ │ │ ├── query.kt │ │ │ │ ├── short.kt │ │ │ │ └── text-plain.kt │ │ └── target.ts │ ├── node │ │ ├── axios │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── fetch │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── native │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── insecure-skip-verify.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── request │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.js │ │ │ │ ├── application-json.js │ │ │ │ ├── cookies.js │ │ │ │ ├── custom-method.js │ │ │ │ ├── full.js │ │ │ │ ├── headers.js │ │ │ │ ├── https.js │ │ │ │ ├── jsonObj-multiline.js │ │ │ │ ├── jsonObj-null-value.js │ │ │ │ ├── multipart-data.js │ │ │ │ ├── multipart-file.js │ │ │ │ ├── multipart-form-data-no-params.js │ │ │ │ ├── multipart-form-data.js │ │ │ │ ├── nested.js │ │ │ │ ├── query.js │ │ │ │ ├── short.js │ │ │ │ └── text-plain.js │ │ ├── target.ts │ │ └── unirest │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ ├── application-form-encoded.js │ │ │ ├── application-json.js │ │ │ ├── cookies.js │ │ │ ├── custom-method.js │ │ │ ├── full.js │ │ │ ├── headers.js │ │ │ ├── https.js │ │ │ ├── jsonObj-multiline.js │ │ │ ├── jsonObj-null-value.js │ │ │ ├── multipart-data.js │ │ │ ├── multipart-file.js │ │ │ ├── multipart-form-data-no-params.js │ │ │ ├── multipart-form-data.js │ │ │ ├── nested.js │ │ │ ├── query.js │ │ │ ├── short.js │ │ │ └── text-plain.js │ ├── objc │ │ ├── helpers.ts │ │ ├── nsurlsession │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.m │ │ │ │ ├── application-json.m │ │ │ │ ├── cookies.m │ │ │ │ ├── custom-method.m │ │ │ │ ├── full.m │ │ │ │ ├── headers.m │ │ │ │ ├── https.m │ │ │ │ ├── indent-option.m │ │ │ │ ├── json-with-null-value.m │ │ │ │ ├── jsonObj-multiline.m │ │ │ │ ├── jsonObj-null-value.m │ │ │ │ ├── multipart-data.m │ │ │ │ ├── multipart-file.m │ │ │ │ ├── multipart-form-data-no-params.m │ │ │ │ ├── multipart-form-data.m │ │ │ │ ├── nested.m │ │ │ │ ├── pretty-option.m │ │ │ │ ├── query.m │ │ │ │ ├── short.m │ │ │ │ ├── text-plain.m │ │ │ │ └── timeout-option.m │ │ └── target.ts │ ├── ocaml │ │ ├── cohttp │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.ml │ │ │ │ ├── application-json.ml │ │ │ │ ├── cookies.ml │ │ │ │ ├── custom-method.ml │ │ │ │ ├── full.ml │ │ │ │ ├── headers.ml │ │ │ │ ├── https.ml │ │ │ │ ├── jsonObj-multiline.ml │ │ │ │ ├── jsonObj-null-value.ml │ │ │ │ ├── multipart-data.ml │ │ │ │ ├── multipart-file.ml │ │ │ │ ├── multipart-form-data-no-params.ml │ │ │ │ ├── multipart-form-data.ml │ │ │ │ ├── nested.ml │ │ │ │ ├── query.ml │ │ │ │ ├── short.ml │ │ │ │ └── text-plain.ml │ │ └── target.ts │ ├── php │ │ ├── curl │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.php │ │ │ │ ├── application-json.php │ │ │ │ ├── cookies.php │ │ │ │ ├── custom-method.php │ │ │ │ ├── full.php │ │ │ │ ├── headers.php │ │ │ │ ├── https.php │ │ │ │ ├── jsonObj-multiline.php │ │ │ │ ├── jsonObj-null-value.php │ │ │ │ ├── multipart-data.php │ │ │ │ ├── multipart-file.php │ │ │ │ ├── multipart-form-data-no-params.php │ │ │ │ ├── multipart-form-data.php │ │ │ │ ├── nested.php │ │ │ │ ├── query.php │ │ │ │ ├── short.php │ │ │ │ └── text-plain.php │ │ ├── guzzle │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.php │ │ │ │ ├── application-json.php │ │ │ │ ├── cookies.php │ │ │ │ ├── custom-method.php │ │ │ │ ├── full.php │ │ │ │ ├── headers.php │ │ │ │ ├── https.php │ │ │ │ ├── jsonObj-multiline.php │ │ │ │ ├── jsonObj-null-value.php │ │ │ │ ├── multipart-data.php │ │ │ │ ├── multipart-file.php │ │ │ │ ├── multipart-form-data-no-params.php │ │ │ │ ├── multipart-form-data.php │ │ │ │ ├── nested.php │ │ │ │ ├── query.php │ │ │ │ ├── short.php │ │ │ │ └── text-plain.php │ │ ├── helpers.ts │ │ ├── http1 │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.php │ │ │ │ ├── application-json.php │ │ │ │ ├── cookies.php │ │ │ │ ├── custom-method.php │ │ │ │ ├── full.php │ │ │ │ ├── headers.php │ │ │ │ ├── https.php │ │ │ │ ├── jsonObj-multiline.php │ │ │ │ ├── jsonObj-null-value.php │ │ │ │ ├── multipart-data.php │ │ │ │ ├── multipart-file.php │ │ │ │ ├── multipart-form-data-no-params.php │ │ │ │ ├── multipart-form-data.php │ │ │ │ ├── nested.php │ │ │ │ ├── query.php │ │ │ │ ├── short.php │ │ │ │ └── text-plain.php │ │ ├── http2 │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.php │ │ │ │ ├── application-json.php │ │ │ │ ├── cookies.php │ │ │ │ ├── custom-method.php │ │ │ │ ├── full.php │ │ │ │ ├── headers.php │ │ │ │ ├── https.php │ │ │ │ ├── jsonObj-multiline.php │ │ │ │ ├── jsonObj-null-value.php │ │ │ │ ├── multipart-data.php │ │ │ │ ├── multipart-file.php │ │ │ │ ├── multipart-form-data-no-params.php │ │ │ │ ├── multipart-form-data.php │ │ │ │ ├── nested.php │ │ │ │ ├── query.php │ │ │ │ ├── short.php │ │ │ │ └── text-plain.php │ │ └── target.ts │ ├── powershell │ │ ├── common.ts │ │ ├── restmethod │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.ps1 │ │ │ │ ├── application-json.ps1 │ │ │ │ ├── cookies.ps1 │ │ │ │ ├── custom-method.ps1 │ │ │ │ ├── full.ps1 │ │ │ │ ├── headers.ps1 │ │ │ │ ├── https.ps1 │ │ │ │ ├── jsonObj-multiline.ps1 │ │ │ │ ├── jsonObj-null-value.ps1 │ │ │ │ ├── multipart-data.ps1 │ │ │ │ ├── multipart-file.ps1 │ │ │ │ ├── multipart-form-data-no-params.ps1 │ │ │ │ ├── multipart-form-data.ps1 │ │ │ │ ├── nested.ps1 │ │ │ │ ├── query.ps1 │ │ │ │ ├── short.ps1 │ │ │ │ └── text-plain.ps1 │ │ ├── target.ts │ │ └── webrequest │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ ├── application-form-encoded.ps1 │ │ │ ├── application-json.ps1 │ │ │ ├── cookies.ps1 │ │ │ ├── custom-method.ps1 │ │ │ ├── full.ps1 │ │ │ ├── headers.ps1 │ │ │ ├── https.ps1 │ │ │ ├── jsonObj-multiline.ps1 │ │ │ ├── jsonObj-null-value.ps1 │ │ │ ├── multipart-data.ps1 │ │ │ ├── multipart-file.ps1 │ │ │ ├── multipart-form-data-no-params.ps1 │ │ │ ├── multipart-form-data.ps1 │ │ │ ├── nested.ps1 │ │ │ ├── query.ps1 │ │ │ ├── short.ps1 │ │ │ └── text-plain.ps1 │ ├── python │ │ ├── helpers.ts │ │ ├── python3 │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.py │ │ │ │ ├── application-json.py │ │ │ │ ├── cookies.py │ │ │ │ ├── custom-method.py │ │ │ │ ├── full.py │ │ │ │ ├── headers.py │ │ │ │ ├── https.py │ │ │ │ ├── insecure-skip-verify.py │ │ │ │ ├── jsonObj-multiline.py │ │ │ │ ├── jsonObj-null-value.py │ │ │ │ ├── multipart-data.py │ │ │ │ ├── multipart-file.py │ │ │ │ ├── multipart-form-data-no-params.py │ │ │ │ ├── multipart-form-data.py │ │ │ │ ├── nested.py │ │ │ │ ├── query.py │ │ │ │ ├── short.py │ │ │ │ └── text-plain.py │ │ ├── requests │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.py │ │ │ │ ├── application-json.py │ │ │ │ ├── cookies.py │ │ │ │ ├── custom-method.py │ │ │ │ ├── full.py │ │ │ │ ├── headers.py │ │ │ │ ├── https.py │ │ │ │ ├── jsonObj-multiline.py │ │ │ │ ├── jsonObj-null-value.py │ │ │ │ ├── multipart-data.py │ │ │ │ ├── multipart-file.py │ │ │ │ ├── multipart-form-data-no-params.py │ │ │ │ ├── multipart-form-data.py │ │ │ │ ├── nested.py │ │ │ │ ├── query-params.py │ │ │ │ ├── query.py │ │ │ │ ├── short.py │ │ │ │ └── text-plain.py │ │ └── target.ts │ ├── r │ │ ├── httr │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.r │ │ │ │ ├── application-json.r │ │ │ │ ├── cookies.r │ │ │ │ ├── custom-method.r │ │ │ │ ├── full.r │ │ │ │ ├── headers.r │ │ │ │ ├── https.r │ │ │ │ ├── jsonObj-multiline.r │ │ │ │ ├── jsonObj-null-value.r │ │ │ │ ├── multipart-data.r │ │ │ │ ├── multipart-file.r │ │ │ │ ├── multipart-form-data-no-params.r │ │ │ │ ├── multipart-form-data.r │ │ │ │ ├── nested.r │ │ │ │ ├── query-two-params.r │ │ │ │ ├── query.r │ │ │ │ ├── short.r │ │ │ │ └── text-plain.r │ │ └── target.ts │ ├── ruby │ │ ├── faraday │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.rb │ │ │ │ ├── application-json.rb │ │ │ │ ├── cookies.rb │ │ │ │ ├── custom-method.rb │ │ │ │ ├── full.rb │ │ │ │ ├── headers.rb │ │ │ │ ├── https.rb │ │ │ │ ├── jsonObj-multiline.rb │ │ │ │ ├── jsonObj-null-value.rb │ │ │ │ ├── multipart-data.rb │ │ │ │ ├── multipart-file.rb │ │ │ │ ├── multipart-form-data-no-params.rb │ │ │ │ ├── multipart-form-data.rb │ │ │ │ ├── nested.rb │ │ │ │ ├── query.rb │ │ │ │ ├── short.rb │ │ │ │ └── text-plain.rb │ │ ├── native │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.rb │ │ │ │ ├── application-json.rb │ │ │ │ ├── cookies.rb │ │ │ │ ├── custom-method.rb │ │ │ │ ├── full.rb │ │ │ │ ├── headers.rb │ │ │ │ ├── https.rb │ │ │ │ ├── insecure-skip-verify.rb │ │ │ │ ├── jsonObj-multiline.rb │ │ │ │ ├── jsonObj-null-value.rb │ │ │ │ ├── multipart-data.rb │ │ │ │ ├── multipart-file.rb │ │ │ │ ├── multipart-form-data-no-params.rb │ │ │ │ ├── multipart-form-data.rb │ │ │ │ ├── nested.rb │ │ │ │ ├── query.rb │ │ │ │ ├── short.rb │ │ │ │ └── text-plain.rb │ │ └── target.ts │ ├── rust │ │ ├── helpers.ts │ │ ├── reqwest │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.rs │ │ │ │ ├── application-json.rs │ │ │ │ ├── cookies.rs │ │ │ │ ├── custom-method.rs │ │ │ │ ├── full.rs │ │ │ │ ├── headers.rs │ │ │ │ ├── https.rs │ │ │ │ ├── jsonObj-multiline.rs │ │ │ │ ├── jsonObj-null-value.rs │ │ │ │ ├── multipart-data.rs │ │ │ │ ├── multipart-file.rs │ │ │ │ ├── multipart-form-data-no-params.rs │ │ │ │ ├── multipart-form-data.rs │ │ │ │ ├── nested.rs │ │ │ │ ├── query.rs │ │ │ │ ├── short.rs │ │ │ │ └── text-plain.rs │ │ └── target.ts │ ├── shell │ │ ├── curl │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── accept-encoding-compressed.sh │ │ │ │ ├── application-form-encoded.sh │ │ │ │ ├── application-json-prettified.sh │ │ │ │ ├── application-json.sh │ │ │ │ ├── binary-option.sh │ │ │ │ ├── cookies.sh │ │ │ │ ├── custom-indentation.sh │ │ │ │ ├── custom-method.sh │ │ │ │ ├── dont-deglob.sh │ │ │ │ ├── full.sh │ │ │ │ ├── globoff-option.sh │ │ │ │ ├── headers.sh │ │ │ │ ├── http1.sh │ │ │ │ ├── http10.sh │ │ │ │ ├── https.sh │ │ │ │ ├── insecure-skip-verify.sh │ │ │ │ ├── jsonObj-multiline.sh │ │ │ │ ├── jsonObj-null-value.sh │ │ │ │ ├── jsonObj-with-singlequotes.sh │ │ │ │ ├── long-globoff-option.sh │ │ │ │ ├── multipart-data.sh │ │ │ │ ├── multipart-file.sh │ │ │ │ ├── multipart-form-data-no-params.sh │ │ │ │ ├── multipart-form-data.sh │ │ │ │ ├── nested.sh │ │ │ │ ├── prettify-short-json.sh │ │ │ │ ├── query.sh │ │ │ │ ├── short-options.sh │ │ │ │ ├── short.sh │ │ │ │ ├── text-plain.sh │ │ │ │ └── urlencode.sh │ │ ├── httpie │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.sh │ │ │ │ ├── application-json.sh │ │ │ │ ├── build-parameters.sh │ │ │ │ ├── cookies.sh │ │ │ │ ├── custom-indentation.sh │ │ │ │ ├── custom-method.sh │ │ │ │ ├── full.sh │ │ │ │ ├── headers.sh │ │ │ │ ├── https.sh │ │ │ │ ├── jsonObj-multiline.sh │ │ │ │ ├── jsonObj-null-value.sh │ │ │ │ ├── long-flags.sh │ │ │ │ ├── multipart-data.sh │ │ │ │ ├── multipart-file.sh │ │ │ │ ├── multipart-form-data-no-params.sh │ │ │ │ ├── multipart-form-data.sh │ │ │ │ ├── nested.sh │ │ │ │ ├── query.sh │ │ │ │ ├── querystring-parameters.sh │ │ │ │ ├── short-flags.sh │ │ │ │ ├── short.sh │ │ │ │ ├── text-plain.sh │ │ │ │ └── verbose-output.sh │ │ ├── target.ts │ │ └── wget │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ ├── application-form-encoded.sh │ │ │ ├── application-json.sh │ │ │ ├── cookies.sh │ │ │ ├── custom-indentation.sh │ │ │ ├── custom-method.sh │ │ │ ├── full.sh │ │ │ ├── headers.sh │ │ │ ├── https.sh │ │ │ ├── jsonObj-multiline.sh │ │ │ ├── jsonObj-null-value.sh │ │ │ ├── multipart-data.sh │ │ │ ├── multipart-file.sh │ │ │ ├── multipart-form-data-no-params.sh │ │ │ ├── multipart-form-data.sh │ │ │ ├── nested.sh │ │ │ ├── query.sh │ │ │ ├── short-options.sh │ │ │ ├── short.sh │ │ │ ├── text-plain.sh │ │ │ ├── v-output.sh │ │ │ └── verbose-output.sh │ ├── swift │ │ ├── helpers.ts │ │ ├── nsurlsession │ │ │ ├── client.test.ts │ │ │ ├── client.ts │ │ │ └── fixtures │ │ │ │ ├── application-form-encoded.swift │ │ │ │ ├── application-json.swift │ │ │ │ ├── cookies.swift │ │ │ │ ├── custom-method.swift │ │ │ │ ├── full.swift │ │ │ │ ├── headers.swift │ │ │ │ ├── https.swift │ │ │ │ ├── indent-option.swift │ │ │ │ ├── json-null-value.swift │ │ │ │ ├── jsonObj-multiline.swift │ │ │ │ ├── jsonObj-null-value.swift │ │ │ │ ├── multipart-data.swift │ │ │ │ ├── multipart-file.swift │ │ │ │ ├── multipart-form-data-no-params.swift │ │ │ │ ├── multipart-form-data.swift │ │ │ │ ├── nested.swift │ │ │ │ ├── pretty-option.swift │ │ │ │ ├── query.swift │ │ │ │ ├── short.swift │ │ │ │ ├── text-plain.swift │ │ │ │ └── timeout-option.swift │ │ └── target.ts │ ├── targets.test.ts │ └── targets.ts └── types │ └── form-data.d.ts ├── tsconfig.build.json └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | src/targets/**/fixtures 2 | dist 3 | bin 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | targets/http/http1.1/fixtures text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | node_modules 3 | coverage* 4 | dist 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Ignore everything by default 2 | # NOTE: NPM publish will never ignore package.json, package-lock.json, README, LICENSE, CHANGELOG 3 | # https://npm.github.io/publishing-pkgs-docs/publishing/the-npmignore-file.html 4 | * 5 | 6 | # Don't ignore dist folder 7 | !dist/** 8 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | src/targets/**/fixtures 4 | dist 5 | bin 6 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | /** @type { import('prettier').Config } */ 2 | module.exports = { 3 | arrowParens: 'avoid', 4 | bracketSameLine: false, 5 | bracketSpacing: true, 6 | jsxSingleQuote: false, 7 | printWidth: 100, 8 | proseWrap: 'never', 9 | quoteProps: 'as-needed', 10 | semi: true, 11 | singleAttributePerLine: true, 12 | singleQuote: true, 13 | tabWidth: 2, 14 | trailingComma: 'all', 15 | useTabs: false, 16 | }; 17 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["EditorConfig.EditorConfig"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.insertFinalNewline": false, // controlled by the .editorconfig at root since we can't map vscode settings directly to files (see: https://github.com/microsoft/vscode/issues/35350) 3 | "editor.defaultFormatter": "esbenp.prettier-vscode" 4 | } 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # specify the node base image with your desired version node: 2 | FROM node:8 3 | 4 | ADD . /src 5 | WORKDIR /src 6 | 7 | RUN apt-get update -qq 8 | RUN apt-get install -qq php7.0 php7.0-curl php7.0-cli 9 | RUN apt-get install -qq --yes python3 10 | -------------------------------------------------------------------------------- /bin/httpsnippet: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../dist/cli.js').go(); 3 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | httpsnippet: 4 | build: . 5 | command: [npm, test] 6 | -------------------------------------------------------------------------------- /src/fixtures/customTarget.ts: -------------------------------------------------------------------------------- 1 | import { request } from '../targets/node/request/client'; 2 | import { Target } from '../targets/targets'; 3 | 4 | export const customTarget = { 5 | info: { 6 | key: 'js-variant', 7 | title: 'JavaScript Variant', 8 | extname: '.js', 9 | default: 'request', 10 | }, 11 | clientsById: { 12 | request, 13 | }, 14 | } as unknown as Target; 15 | -------------------------------------------------------------------------------- /src/fixtures/requests/application-json.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "POST", 3 | "url": "http://mockbin.com/har", 4 | "headers": [ 5 | { 6 | "name": "content-type", 7 | "value": "application/json" 8 | } 9 | ], 10 | "postData": { 11 | "mimeType": "application/json", 12 | "text": "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/fixtures/requests/cookies.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "POST", 3 | "url": "http://mockbin.com/har", 4 | "cookies": [ 5 | { 6 | "name": "foo", 7 | "value": "bar" 8 | }, 9 | { 10 | "name": "bar", 11 | "value": "baz" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /src/fixtures/requests/custom-method.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "PROPFIND", 3 | "url": "http://mockbin.com/har" 4 | } 5 | -------------------------------------------------------------------------------- /src/fixtures/requests/headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "GET", 3 | "url": "http://mockbin.com/har", 4 | "headers": [ 5 | { 6 | "name": "accept", 7 | "value": "application/json" 8 | }, 9 | { 10 | "name": "x-foo", 11 | "value": "Bar" 12 | }, 13 | { 14 | "name": "quoted-value", 15 | "value": "\"quoted\" 'string'" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/fixtures/requests/https.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "GET", 3 | "url": "https://mockbin.com/har" 4 | } 5 | -------------------------------------------------------------------------------- /src/fixtures/requests/jsonObj-multiline.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://mockbin.com/har", 3 | "method": "POST", 4 | "headers": [ 5 | { 6 | "name": "content-type", 7 | "value": "application/json" 8 | } 9 | ], 10 | "postData": { 11 | "text": "{\n \"foo\": \"bar\"\n}", 12 | "mimeType": "application/json" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/fixtures/requests/jsonObj-null-value.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://mockbin.com/har", 3 | "method": "POST", 4 | "headers": [ 5 | { 6 | "name": "content-type", 7 | "value": "application/json" 8 | } 9 | ], 10 | "postData": { 11 | "params": [], 12 | "text": "{\"foo\":null}", 13 | "stored": true, 14 | "mimeType": "application/json", 15 | "size": 0, 16 | "jsonObj": { 17 | "foo": null 18 | }, 19 | "paramsObj": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/fixtures/requests/multipart-file.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "POST", 3 | "url": "http://mockbin.com/har", 4 | "headers": [ 5 | { 6 | "name": "content-type", 7 | "value": "multipart/form-data" 8 | } 9 | ], 10 | "postData": { 11 | "mimeType": "multipart/form-data", 12 | "params": [ 13 | { 14 | "name": "foo", 15 | "fileName": "test/fixtures/files/hello.txt", 16 | "contentType": "text/plain" 17 | } 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/fixtures/requests/multipart-form-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "POST", 3 | "url": "http://mockbin.com/har", 4 | "headers": [ 5 | { 6 | "name": "Content-Type", 7 | "value": "multipart/form-data" 8 | } 9 | ], 10 | "postData": { 11 | "mimeType": "multipart/form-data", 12 | "params": [ 13 | { 14 | "name": "foo", 15 | "value": "bar" 16 | } 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/fixtures/requests/nested.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "GET", 3 | "url": "http://mockbin.com/har", 4 | "httpVersion": "HTTP/1.1", 5 | "queryString": [ 6 | { 7 | "name": "foo[bar]", 8 | "value": "baz,zap" 9 | }, 10 | { 11 | "name": "fiz", 12 | "value": "buz" 13 | }, 14 | { 15 | "name": "key", 16 | "value": "value" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/fixtures/requests/query.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "GET", 3 | "url": "http://mockbin.com/har?key=value", 4 | "httpVersion": "HTTP/1.1", 5 | "queryString": [ 6 | { 7 | "name": "foo", 8 | "value": "bar" 9 | }, 10 | { 11 | "name": "foo", 12 | "value": "baz" 13 | }, 14 | { 15 | "name": "baz", 16 | "value": "abc" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/fixtures/requests/short.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "GET", 3 | "url": "http://mockbin.com/har" 4 | } 5 | -------------------------------------------------------------------------------- /src/fixtures/requests/text-plain.json: -------------------------------------------------------------------------------- 1 | { 2 | "method": "POST", 3 | "url": "http://mockbin.com/har", 4 | "headers": [ 5 | { 6 | "name": "content-type", 7 | "value": "text/plain" 8 | } 9 | ], 10 | "postData": { 11 | "mimeType": "text/plain", 12 | "text": "Hello World" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/cookies.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har"); 5 | 6 | curl_easy_setopt(hnd, CURLOPT_COOKIE, "foo=bar; bar=baz"); 7 | 8 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/custom-method.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PROPFIND"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har"); 5 | 6 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/https.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "https://mockbin.com/har"); 5 | 6 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/multipart-form-data-no-params.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har"); 5 | 6 | struct curl_slist *headers = NULL; 7 | headers = curl_slist_append(headers, "Content-Type: multipart/form-data"); 8 | curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); 9 | 10 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/nested.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"); 5 | 6 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/query.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value"); 5 | 6 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/short.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har"); 5 | 6 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/libcurl/fixtures/text-plain.c: -------------------------------------------------------------------------------- 1 | CURL *hnd = curl_easy_init(); 2 | 3 | curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); 4 | curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har"); 5 | 6 | struct curl_slist *headers = NULL; 7 | headers = curl_slist_append(headers, "content-type: text/plain"); 8 | curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); 9 | 10 | curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "Hello World"); 11 | 12 | CURLcode ret = curl_easy_perform(hnd); -------------------------------------------------------------------------------- /src/targets/c/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { libcurl } from './libcurl/client'; 3 | 4 | export const c: Target = { 5 | info: { 6 | key: 'c', 7 | title: 'C', 8 | extname: '.c', 9 | default: 'libcurl', 10 | }, 11 | clientsById: { 12 | libcurl, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/application-form-encoded.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:form-params {:foo "bar" 4 | :hello "world"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/cookies.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:headers {:cookie "foo=bar; bar=baz"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/custom-method.clj: -------------------------------------------------------------------------------- 1 | Method not supported -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/headers.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/get "http://mockbin.com/har" {:headers {:x-foo "Bar" 4 | :quoted-value "\"quoted\" 'string'"} 5 | :accept :json}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/https.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/get "https://mockbin.com/har") -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/jsonObj-multiline.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:content-type :json 4 | :form-params {:foo "bar"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/jsonObj-null-value.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:content-type :json 4 | :form-params {:foo nil}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/multipart-data.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:multipart [{:name "foo" 4 | :content "Hello World"} {:name "bar" 5 | :content "Bonjour le monde"}]}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/multipart-file.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:multipart [{:name "foo" 4 | :content (clojure.java.io/file "test/fixtures/files/hello.txt")}]}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/multipart-form-data-no-params.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:headers {:Content-Type "multipart/form-data"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/multipart-form-data.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:multipart [{:name "foo" 4 | :content "bar"}]}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/nested.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/get "http://mockbin.com/har" {:query-params {:foo[bar] "baz,zap" 4 | :fiz "buz" 5 | :key "value"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/query.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/get "http://mockbin.com/har" {:query-params {:foo ["bar" "baz"] 4 | :baz "abc" 5 | :key "value"}}) -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/short.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/get "http://mockbin.com/har") -------------------------------------------------------------------------------- /src/targets/clojure/clj_http/fixtures/text-plain.clj: -------------------------------------------------------------------------------- 1 | (require '[clj-http.client :as client]) 2 | 3 | (client/post "http://mockbin.com/har" {:body "Hello World"}) -------------------------------------------------------------------------------- /src/targets/clojure/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { clj_http } from './clj_http/client'; 3 | 4 | export const clojure: Target = { 5 | info: { 6 | key: 'clojure', 7 | title: 'Clojure', 8 | extname: '.clj', 9 | default: 'clj_http', 10 | }, 11 | clientsById: { 12 | clj_http, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/application-form-encoded.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "content-type" => "application/x-www-form-urlencoded" 6 | } 7 | reqBody = "foo=bar&hello=world" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/application-json.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "content-type" => "application/json" 6 | } 7 | reqBody = "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/cookies.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "cookie" => "foo=bar; bar=baz" 6 | } 7 | 8 | response = HTTP::Client.post url, headers: headers 9 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/custom-method.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | response = HTTP::Client.exec "PROPFIND", url 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/full.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value" 4 | headers = HTTP::Headers{ 5 | "cookie" => "foo=bar; bar=baz" 6 | "accept" => "application/json" 7 | "content-type" => "application/x-www-form-urlencoded" 8 | } 9 | reqBody = "foo=bar" 10 | 11 | response = HTTP::Client.post url, headers: headers, body: reqBody 12 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/headers.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "accept" => "application/json" 6 | "x-foo" => "Bar" 7 | "quoted-value" => "\"quoted\" 'string'" 8 | } 9 | 10 | response = HTTP::Client.get url, headers: headers 11 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/https.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "https://mockbin.com/har" 4 | 5 | response = HTTP::Client.get url 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/insecure-skip-verify.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "https://mockbin.com/har" 4 | 5 | response = HTTP::Client.get url, tls: OpenSSL::SSL::Context::Client.insecure 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/jsonObj-multiline.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "content-type" => "application/json" 6 | } 7 | reqBody = "{\n \"foo\": \"bar\"\n}" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/jsonObj-null-value.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "content-type" => "application/json" 6 | } 7 | reqBody = "{\"foo\":null}" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/multipart-form-data-no-params.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "Content-Type" => "multipart/form-data" 6 | } 7 | 8 | response = HTTP::Client.post url, headers: headers 9 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/multipart-form-data.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "Content-Type" => "multipart/form-data; boundary=---011000010111000001101001" 6 | } 7 | reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/nested.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" 4 | 5 | response = HTTP::Client.get url 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/query.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value" 4 | 5 | response = HTTP::Client.get url 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/short.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | response = HTTP::Client.get url 6 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/native/fixtures/text-plain.cr: -------------------------------------------------------------------------------- 1 | require "http/client" 2 | 3 | url = "http://mockbin.com/har" 4 | headers = HTTP::Headers{ 5 | "content-type" => "text/plain" 6 | } 7 | reqBody = "Hello World" 8 | 9 | response = HTTP::Client.post url, headers: headers, body: reqBody 10 | puts response.body -------------------------------------------------------------------------------- /src/targets/crystal/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { native } from './native/client'; 3 | 4 | export const crystal: Target = { 5 | info: { 6 | key: 'crystal', 7 | title: 'Crystal', 8 | extname: '.cr', 9 | default: 'native', 10 | }, 11 | clientsById: { 12 | native, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/csharp/httpclient/fixtures/custom-method.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | var client = new HttpClient(); 3 | var request = new HttpRequestMessage 4 | { 5 | Method = new HttpMethod("PROPFIND"), 6 | RequestUri = new Uri("http://mockbin.com/har"), 7 | }; 8 | using (var response = await client.SendAsync(request)) 9 | { 10 | response.EnsureSuccessStatusCode(); 11 | var body = await response.Content.ReadAsStringAsync(); 12 | Console.WriteLine(body); 13 | } -------------------------------------------------------------------------------- /src/targets/csharp/httpclient/fixtures/https.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | var client = new HttpClient(); 3 | var request = new HttpRequestMessage 4 | { 5 | Method = HttpMethod.Get, 6 | RequestUri = new Uri("https://mockbin.com/har"), 7 | }; 8 | using (var response = await client.SendAsync(request)) 9 | { 10 | response.EnsureSuccessStatusCode(); 11 | var body = await response.Content.ReadAsStringAsync(); 12 | Console.WriteLine(body); 13 | } -------------------------------------------------------------------------------- /src/targets/csharp/httpclient/fixtures/multipart-form-data-no-params.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | var client = new HttpClient(); 3 | var request = new HttpRequestMessage 4 | { 5 | Method = HttpMethod.Post, 6 | RequestUri = new Uri("http://mockbin.com/har"), 7 | }; 8 | using (var response = await client.SendAsync(request)) 9 | { 10 | response.EnsureSuccessStatusCode(); 11 | var body = await response.Content.ReadAsStringAsync(); 12 | Console.WriteLine(body); 13 | } -------------------------------------------------------------------------------- /src/targets/csharp/httpclient/fixtures/short.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | var client = new HttpClient(); 3 | var request = new HttpRequestMessage 4 | { 5 | Method = HttpMethod.Get, 6 | RequestUri = new Uri("http://mockbin.com/har"), 7 | }; 8 | using (var response = await client.SendAsync(request)) 9 | { 10 | response.EnsureSuccessStatusCode(); 11 | var body = await response.Content.ReadAsStringAsync(); 12 | Console.WriteLine(body); 13 | } -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/application-form-encoded.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("content-type", "application/x-www-form-urlencoded"); 4 | request.AddParameter("application/x-www-form-urlencoded", "foo=bar&hello=world", ParameterType.RequestBody); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/application-json.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("content-type", "application/json"); 4 | request.AddParameter("application/json", "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}", ParameterType.RequestBody); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/cookies.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddCookie("foo", "bar"); 4 | request.AddCookie("bar", "baz"); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/custom-method.cs: -------------------------------------------------------------------------------- 1 | Method not supported -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/headers.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Get); 3 | request.AddHeader("accept", "application/json"); 4 | request.AddHeader("x-foo", "Bar"); 5 | request.AddHeader("quoted-value", "\"quoted\" 'string'"); 6 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/https.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("https://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Get); 3 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/jsonObj-multiline.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("content-type", "application/json"); 4 | request.AddParameter("application/json", "{\n \"foo\": \"bar\"\n}", ParameterType.RequestBody); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/jsonObj-null-value.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("content-type", "application/json"); 4 | request.AddParameter("application/json", "{\"foo\":null}", ParameterType.RequestBody); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/multipart-form-data-no-params.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("Content-Type", "multipart/form-data"); 4 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/nested.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"); 2 | var request = new RestRequest("", Method.Get); 3 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/query.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value"); 2 | var request = new RestRequest("", Method.Get); 3 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/short.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Get); 3 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/restsharp/fixtures/text-plain.cs: -------------------------------------------------------------------------------- 1 | var client = new RestClient("http://mockbin.com/har"); 2 | var request = new RestRequest("", Method.Post); 3 | request.AddHeader("content-type", "text/plain"); 4 | request.AddParameter("text/plain", "Hello World", ParameterType.RequestBody); 5 | var response = client.Execute(request); -------------------------------------------------------------------------------- /src/targets/csharp/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { httpclient } from './httpclient/client'; 3 | import { restsharp } from './restsharp/client'; 4 | 5 | export const csharp: Target = { 6 | info: { 7 | key: 'csharp', 8 | title: 'C#', 9 | extname: '.cs', 10 | default: 'restsharp', 11 | }, 12 | 13 | clientsById: { 14 | httpclient, 15 | restsharp, 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/cookies.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "http://mockbin.com/har" 12 | 13 | req, _ := http.NewRequest("POST", url, nil) 14 | 15 | req.Header.Add("cookie", "foo=bar; bar=baz") 16 | 17 | res, _ := http.DefaultClient.Do(req) 18 | 19 | defer res.Body.Close() 20 | body, _ := io.ReadAll(res.Body) 21 | 22 | fmt.Println(res) 23 | fmt.Println(string(body)) 24 | 25 | } -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/custom-method.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "http://mockbin.com/har" 12 | 13 | req, _ := http.NewRequest("PROPFIND", url, nil) 14 | 15 | res, _ := http.DefaultClient.Do(req) 16 | 17 | defer res.Body.Close() 18 | body, _ := io.ReadAll(res.Body) 19 | 20 | fmt.Println(res) 21 | fmt.Println(string(body)) 22 | 23 | } -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/https.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "https://mockbin.com/har" 12 | 13 | req, _ := http.NewRequest("GET", url, nil) 14 | 15 | res, _ := http.DefaultClient.Do(req) 16 | 17 | defer res.Body.Close() 18 | body, _ := io.ReadAll(res.Body) 19 | 20 | fmt.Println(res) 21 | fmt.Println(string(body)) 22 | 23 | } -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/nested.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" 12 | 13 | req, _ := http.NewRequest("GET", url, nil) 14 | 15 | res, _ := http.DefaultClient.Do(req) 16 | 17 | defer res.Body.Close() 18 | body, _ := io.ReadAll(res.Body) 19 | 20 | fmt.Println(res) 21 | fmt.Println(string(body)) 22 | 23 | } -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/query.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value" 12 | 13 | req, _ := http.NewRequest("GET", url, nil) 14 | 15 | res, _ := http.DefaultClient.Do(req) 16 | 17 | defer res.Body.Close() 18 | body, _ := io.ReadAll(res.Body) 19 | 20 | fmt.Println(res) 21 | fmt.Println(string(body)) 22 | 23 | } -------------------------------------------------------------------------------- /src/targets/go/native/fixtures/short.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "io" 7 | ) 8 | 9 | func main() { 10 | 11 | url := "http://mockbin.com/har" 12 | 13 | req, _ := http.NewRequest("GET", url, nil) 14 | 15 | res, _ := http.DefaultClient.Do(req) 16 | 17 | defer res.Body.Close() 18 | body, _ := io.ReadAll(res.Body) 19 | 20 | fmt.Println(res) 21 | fmt.Println(string(body)) 22 | 23 | } -------------------------------------------------------------------------------- /src/targets/go/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { native } from './native/client'; 3 | 4 | export const go: Target = { 5 | info: { 6 | key: 'go', 7 | title: 'Go', 8 | extname: '.go', 9 | default: 'native', 10 | }, 11 | clientsById: { 12 | native, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/application-form-encoded: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: application/x-www-form-urlencoded 3 | Host: mockbin.com 4 | Content-Length: 19 5 | 6 | foo=bar&hello=world -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/application-json: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: application/json 3 | Host: mockbin.com 4 | Content-Length: 118 5 | 6 | {"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false} -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/cookies: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Cookie: foo=bar; bar=baz 3 | Host: mockbin.com 4 | 5 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/custom-method: -------------------------------------------------------------------------------- 1 | PROPFIND /har HTTP/1.1 2 | Host: mockbin.com 3 | 4 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/full: -------------------------------------------------------------------------------- 1 | POST /har?foo=bar&foo=baz&baz=abc&key=value HTTP/1.1 2 | Cookie: foo=bar; bar=baz 3 | Accept: application/json 4 | Content-Type: application/x-www-form-urlencoded 5 | Host: mockbin.com 6 | Content-Length: 7 7 | 8 | foo=bar -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/headers: -------------------------------------------------------------------------------- 1 | GET /har HTTP/1.1 2 | Accept: application/json 3 | X-Foo: Bar 4 | Quoted-Value: "quoted" 'string' 5 | Host: mockbin.com 6 | 7 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/https: -------------------------------------------------------------------------------- 1 | GET /har HTTP/1.1 2 | Host: mockbin.com 3 | 4 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/jsonObj-multiline: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: application/json 3 | Host: mockbin.com 4 | Content-Length: 18 5 | 6 | { 7 | "foo": "bar" 8 | } -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/jsonObj-null-value: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: application/json 3 | Host: mockbin.com 4 | Content-Length: 12 5 | 6 | {"foo":null} -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/multipart-file: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: multipart/form-data; boundary=---011000010111000001101001 3 | Host: mockbin.com 4 | Content-Length: 160 5 | 6 | -----011000010111000001101001 7 | Content-Disposition: form-data; name="foo"; filename="hello.txt" 8 | Content-Type: text/plain 9 | 10 | 11 | -----011000010111000001101001-- 12 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/multipart-form-data: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: multipart/form-data; boundary=---011000010111000001101001 3 | Host: mockbin.com 4 | Content-Length: 115 5 | 6 | -----011000010111000001101001 7 | Content-Disposition: form-data; name="foo" 8 | 9 | bar 10 | -----011000010111000001101001-- 11 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/multipart-form-data-no-params: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: multipart/form-data 3 | Host: mockbin.com 4 | 5 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/nested: -------------------------------------------------------------------------------- 1 | GET /har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value HTTP/1.1 2 | Host: mockbin.com 3 | 4 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/query: -------------------------------------------------------------------------------- 1 | GET /har?foo=bar&foo=baz&baz=abc&key=value HTTP/1.1 2 | Host: mockbin.com 3 | 4 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/short: -------------------------------------------------------------------------------- 1 | GET /har HTTP/1.1 2 | Host: mockbin.com 3 | 4 | -------------------------------------------------------------------------------- /src/targets/http/http1.1/fixtures/text-plain: -------------------------------------------------------------------------------- 1 | POST /har HTTP/1.1 2 | Content-Type: text/plain 3 | Host: mockbin.com 4 | Content-Length: 11 5 | 6 | Hello World -------------------------------------------------------------------------------- /src/targets/http/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { http11 } from './http1.1/client'; 3 | 4 | export const http: Target = { 5 | info: { 6 | key: 'http', 7 | title: 'HTTP', 8 | extname: null, 9 | default: '1.1', 10 | }, 11 | clientsById: { 12 | 'http1.1': http11, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/application-form-encoded.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("content-type", "application/x-www-form-urlencoded") 4 | .setBody("foo=bar&hello=world") 5 | .execute() 6 | .toCompletableFuture() 7 | .thenAccept(System.out::println) 8 | .join(); 9 | 10 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/cookies.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("cookie", "foo=bar; bar=baz") 4 | .execute() 5 | .toCompletableFuture() 6 | .thenAccept(System.out::println) 7 | .join(); 8 | 9 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/custom-method.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("PROPFIND", "http://mockbin.com/har") 3 | .execute() 4 | .toCompletableFuture() 5 | .thenAccept(System.out::println) 6 | .join(); 7 | 8 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/headers.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("GET", "http://mockbin.com/har") 3 | .setHeader("accept", "application/json") 4 | .setHeader("x-foo", "Bar") 5 | .setHeader("quoted-value", "\"quoted\" 'string'") 6 | .execute() 7 | .toCompletableFuture() 8 | .thenAccept(System.out::println) 9 | .join(); 10 | 11 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/https.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("GET", "https://mockbin.com/har") 3 | .execute() 4 | .toCompletableFuture() 5 | .thenAccept(System.out::println) 6 | .join(); 7 | 8 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/jsonObj-multiline.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("content-type", "application/json") 4 | .setBody("{\n \"foo\": \"bar\"\n}") 5 | .execute() 6 | .toCompletableFuture() 7 | .thenAccept(System.out::println) 8 | .join(); 9 | 10 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/jsonObj-null-value.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("content-type", "application/json") 4 | .setBody("{\"foo\":null}") 5 | .execute() 6 | .toCompletableFuture() 7 | .thenAccept(System.out::println) 8 | .join(); 9 | 10 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/multipart-form-data-no-params.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("Content-Type", "multipart/form-data") 4 | .execute() 5 | .toCompletableFuture() 6 | .thenAccept(System.out::println) 7 | .join(); 8 | 9 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/nested.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("GET", "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 3 | .execute() 4 | .toCompletableFuture() 5 | .thenAccept(System.out::println) 6 | .join(); 7 | 8 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/query.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("GET", "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 3 | .execute() 4 | .toCompletableFuture() 5 | .thenAccept(System.out::println) 6 | .join(); 7 | 8 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/short.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("GET", "http://mockbin.com/har") 3 | .execute() 4 | .toCompletableFuture() 5 | .thenAccept(System.out::println) 6 | .join(); 7 | 8 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/asynchttp/fixtures/text-plain.java: -------------------------------------------------------------------------------- 1 | AsyncHttpClient client = new DefaultAsyncHttpClient(); 2 | client.prepare("POST", "http://mockbin.com/har") 3 | .setHeader("content-type", "text/plain") 4 | .setBody("Hello World") 5 | .execute() 6 | .toCompletableFuture() 7 | .thenAccept(System.out::println) 8 | .join(); 9 | 10 | client.close(); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/application-form-encoded.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("content-type", "application/x-www-form-urlencoded") 4 | .method("POST", HttpRequest.BodyPublishers.ofString("foo=bar&hello=world")) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/cookies.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("cookie", "foo=bar; bar=baz") 4 | .method("POST", HttpRequest.BodyPublishers.noBody()) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/custom-method.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .method("PROPFIND", HttpRequest.BodyPublishers.noBody()) 4 | .build(); 5 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 6 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/https.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("https://mockbin.com/har")) 3 | .method("GET", HttpRequest.BodyPublishers.noBody()) 4 | .build(); 5 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 6 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/jsonObj-multiline.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("content-type", "application/json") 4 | .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"foo\": \"bar\"\n}")) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/jsonObj-null-value.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("content-type", "application/json") 4 | .method("POST", HttpRequest.BodyPublishers.ofString("{\"foo\":null}")) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/multipart-form-data-no-params.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("Content-Type", "multipart/form-data") 4 | .method("POST", HttpRequest.BodyPublishers.noBody()) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/nested.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")) 3 | .method("GET", HttpRequest.BodyPublishers.noBody()) 4 | .build(); 5 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 6 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/query.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value")) 3 | .method("GET", HttpRequest.BodyPublishers.noBody()) 4 | .build(); 5 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 6 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/short.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .method("GET", HttpRequest.BodyPublishers.noBody()) 4 | .build(); 5 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 6 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/nethttp/fixtures/text-plain.java: -------------------------------------------------------------------------------- 1 | HttpRequest request = HttpRequest.newBuilder() 2 | .uri(URI.create("http://mockbin.com/har")) 3 | .header("content-type", "text/plain") 4 | .method("POST", HttpRequest.BodyPublishers.ofString("Hello World")) 5 | .build(); 6 | HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); 7 | System.out.println(response.body()); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/cookies.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .post(null) 6 | .addHeader("cookie", "foo=bar; bar=baz") 7 | .build(); 8 | 9 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/custom-method.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .method("PROPFIND", null) 6 | .build(); 7 | 8 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/headers.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .get() 6 | .addHeader("accept", "application/json") 7 | .addHeader("x-foo", "Bar") 8 | .addHeader("quoted-value", "\"quoted\" 'string'") 9 | .build(); 10 | 11 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/https.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("https://mockbin.com/har") 5 | .get() 6 | .build(); 7 | 8 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/jsonObj-multiline.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | MediaType mediaType = MediaType.parse("application/json"); 4 | RequestBody body = RequestBody.create(mediaType, "{\n \"foo\": \"bar\"\n}"); 5 | Request request = new Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "application/json") 9 | .build(); 10 | 11 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/jsonObj-null-value.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | MediaType mediaType = MediaType.parse("application/json"); 4 | RequestBody body = RequestBody.create(mediaType, "{\"foo\":null}"); 5 | Request request = new Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "application/json") 9 | .build(); 10 | 11 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/multipart-form-data-no-params.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .post(null) 6 | .addHeader("Content-Type", "multipart/form-data") 7 | .build(); 8 | 9 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/nested.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 5 | .get() 6 | .build(); 7 | 8 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/query.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 5 | .get() 6 | .build(); 7 | 8 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/short.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | Request request = new Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .get() 6 | .build(); 7 | 8 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/okhttp/fixtures/text-plain.java: -------------------------------------------------------------------------------- 1 | OkHttpClient client = new OkHttpClient(); 2 | 3 | MediaType mediaType = MediaType.parse("text/plain"); 4 | RequestBody body = RequestBody.create(mediaType, "Hello World"); 5 | Request request = new Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "text/plain") 9 | .build(); 10 | 11 | Response response = client.newCall(request).execute(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/application-form-encoded.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "application/x-www-form-urlencoded") 3 | .body("foo=bar&hello=world") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/application-json.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "application/json") 3 | .body("{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/cookies.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("cookie", "foo=bar; bar=baz") 3 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/custom-method.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.customMethod("PROPFIND","http://mockbin.com/har") 2 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/full.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 2 | .header("cookie", "foo=bar; bar=baz") 3 | .header("accept", "application/json") 4 | .header("content-type", "application/x-www-form-urlencoded") 5 | .body("foo=bar") 6 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/headers.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.get("http://mockbin.com/har") 2 | .header("accept", "application/json") 3 | .header("x-foo", "Bar") 4 | .header("quoted-value", "\"quoted\" 'string'") 5 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/https.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.get("https://mockbin.com/har") 2 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/jsonObj-multiline.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "application/json") 3 | .body("{\n \"foo\": \"bar\"\n}") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/jsonObj-null-value.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "application/json") 3 | .body("{\"foo\":null}") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/multipart-file.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "multipart/form-data; boundary=---011000010111000001101001") 3 | .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n-----011000010111000001101001--\r\n") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/multipart-form-data-no-params.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("Content-Type", "multipart/form-data") 3 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/multipart-form-data.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") 3 | .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/nested.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.get("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 2 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/query.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.get("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 2 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/short.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.get("http://mockbin.com/har") 2 | .asString(); -------------------------------------------------------------------------------- /src/targets/java/unirest/fixtures/text-plain.java: -------------------------------------------------------------------------------- 1 | HttpResponse response = Unirest.post("http://mockbin.com/har") 2 | .header("content-type", "text/plain") 3 | .body("Hello World") 4 | .asString(); -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {cookie: 'foo=bar; bar=baz'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = {method: 'PROPFIND', url: 'http://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | headers: { 7 | accept: 'application/json', 8 | 'x-foo': 'Bar', 9 | 'quoted-value': '"quoted" \'string\'' 10 | } 11 | }; 12 | 13 | try { 14 | const { data } = await axios.request(options); 15 | console.log(data); 16 | } catch (error) { 17 | console.error(error); 18 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/https.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = {method: 'GET', url: 'https://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | data: {foo: 'bar'} 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | data: {foo: null} 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'Content-Type': 'multipart/form-data'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | params: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/query.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | params: {foo: ['bar', 'baz'], baz: 'abc', key: 'value'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/short.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = {method: 'GET', url: 'http://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/axios/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'text/plain'}, 7 | data: 'Hello World' 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/application-form-encoded.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = { 3 | method: 'POST', 4 | headers: {'content-type': 'application/x-www-form-urlencoded'}, 5 | body: new URLSearchParams({foo: 'bar', hello: 'world'}) 6 | }; 7 | 8 | try { 9 | const response = await fetch(url, options); 10 | const data = await response.json(); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = {method: 'POST', headers: {cookie: 'foo=bar; bar=baz'}}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = {method: 'PROPFIND'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = { 3 | method: 'GET', 4 | headers: { 5 | accept: 'application/json', 6 | 'x-foo': 'Bar', 7 | 'quoted-value': '"quoted" \'string\'' 8 | } 9 | }; 10 | 11 | try { 12 | const response = await fetch(url, options); 13 | const data = await response.json(); 14 | console.log(data); 15 | } catch (error) { 16 | console.error(error); 17 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const url = 'https://mockbin.com/har'; 2 | const options = {method: 'GET'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = { 3 | method: 'POST', 4 | headers: {'content-type': 'application/json'}, 5 | body: '{"foo":"bar"}' 6 | }; 7 | 8 | try { 9 | const response = await fetch(url, options); 10 | const data = await response.json(); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = { 3 | method: 'POST', 4 | headers: {'content-type': 'application/json'}, 5 | body: '{"foo":null}' 6 | }; 7 | 8 | try { 9 | const response = await fetch(url, options); 10 | const data = await response.json(); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/multipart-data.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const form = new FormData(); 3 | form.append('foo', 'Hello World'); 4 | form.append('bar', 'Bonjour le monde'); 5 | 6 | const options = {method: 'POST'}; 7 | 8 | options.body = form; 9 | 10 | try { 11 | const response = await fetch(url, options); 12 | const data = await response.json(); 13 | console.log(data); 14 | } catch (error) { 15 | console.error(error); 16 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/multipart-file.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const form = new FormData(); 3 | form.append('foo', 'test/fixtures/files/hello.txt'); 4 | 5 | const options = {method: 'POST'}; 6 | 7 | options.body = form; 8 | 9 | try { 10 | const response = await fetch(url, options); 11 | const data = await response.json(); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = {method: 'POST', headers: {'Content-Type': 'multipart/form-data'}}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/multipart-form-data.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const form = new FormData(); 3 | form.append('foo', 'bar'); 4 | 5 | const options = {method: 'POST'}; 6 | 7 | options.body = form; 8 | 9 | try { 10 | const response = await fetch(url, options); 11 | const data = await response.json(); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'; 2 | const options = {method: 'GET'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'; 2 | const options = {method: 'GET'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = {method: 'GET'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/fetch/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const url = 'http://mockbin.com/har'; 2 | const options = {method: 'POST', headers: {'content-type': 'text/plain'}, body: 'Hello World'}; 3 | 4 | try { 5 | const response = await fetch(url, options); 6 | const data = await response.json(); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/application-form-encoded.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | 'content-type': 'application/x-www-form-urlencoded' 8 | }, 9 | data: { 10 | foo: 'bar', 11 | hello: 'world' 12 | } 13 | }; 14 | 15 | $.ajax(settings).done(function (response) { 16 | console.log(response); 17 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | cookie: 'foo=bar; bar=baz' 8 | } 9 | }; 10 | 11 | $.ajax(settings).done(function (response) { 12 | console.log(response); 13 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'PROPFIND', 6 | headers: {} 7 | }; 8 | 9 | $.ajax(settings).done(function (response) { 10 | console.log(response); 11 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'GET', 6 | headers: { 7 | accept: 'application/json', 8 | 'x-foo': 'Bar', 9 | 'quoted-value': '"quoted" \'string\'' 10 | } 11 | }; 12 | 13 | $.ajax(settings).done(function (response) { 14 | console.log(response); 15 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'https://mockbin.com/har', 5 | method: 'GET', 6 | headers: {} 7 | }; 8 | 9 | $.ajax(settings).done(function (response) { 10 | console.log(response); 11 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | 'content-type': 'application/json' 8 | }, 9 | processData: false, 10 | data: '{\n "foo": "bar"\n}' 11 | }; 12 | 13 | $.ajax(settings).done(function (response) { 14 | console.log(response); 15 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | 'content-type': 'application/json' 8 | }, 9 | processData: false, 10 | data: '{"foo":null}' 11 | }; 12 | 13 | $.ajax(settings).done(function (response) { 14 | console.log(response); 15 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | 'Content-Type': 'multipart/form-data' 8 | } 9 | }; 10 | 11 | $.ajax(settings).done(function (response) { 12 | console.log(response); 13 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/multipart-form-data.js: -------------------------------------------------------------------------------- 1 | const form = new FormData(); 2 | form.append('foo', 'bar'); 3 | 4 | const settings = { 5 | async: true, 6 | crossDomain: true, 7 | url: 'http://mockbin.com/har', 8 | method: 'POST', 9 | headers: {}, 10 | processData: false, 11 | contentType: false, 12 | mimeType: 'multipart/form-data', 13 | data: form 14 | }; 15 | 16 | $.ajax(settings).done(function (response) { 17 | console.log(response); 18 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value', 5 | method: 'GET', 6 | headers: {} 7 | }; 8 | 9 | $.ajax(settings).done(function (response) { 10 | console.log(response); 11 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value', 5 | method: 'GET', 6 | headers: {} 7 | }; 8 | 9 | $.ajax(settings).done(function (response) { 10 | console.log(response); 11 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'GET', 6 | headers: {} 7 | }; 8 | 9 | $.ajax(settings).done(function (response) { 10 | console.log(response); 11 | }); -------------------------------------------------------------------------------- /src/targets/javascript/jquery/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const settings = { 2 | async: true, 3 | crossDomain: true, 4 | url: 'http://mockbin.com/har', 5 | method: 'POST', 6 | headers: { 7 | 'content-type': 'text/plain' 8 | }, 9 | data: 'Hello World' 10 | }; 11 | 12 | $.ajax(settings).done(function (response) { 13 | console.log(response); 14 | }); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/application-form-encoded.js: -------------------------------------------------------------------------------- 1 | const data = 'foo=bar&hello=world'; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('POST', 'http://mockbin.com/har'); 13 | xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded'); 14 | 15 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('POST', 'http://mockbin.com/har'); 13 | xhr.setRequestHeader('cookie', 'foo=bar; bar=baz'); 14 | 15 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/cors.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | 5 | xhr.addEventListener('readystatechange', function () { 6 | if (this.readyState === this.DONE) { 7 | console.log(this.responseText); 8 | } 9 | }); 10 | 11 | xhr.open('GET', 'http://mockbin.com/har'); 12 | 13 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('PROPFIND', 'http://mockbin.com/har'); 13 | 14 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('GET', 'https://mockbin.com/har'); 13 | 14 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const data = JSON.stringify({ 2 | foo: 'bar' 3 | }); 4 | 5 | const xhr = new XMLHttpRequest(); 6 | xhr.withCredentials = true; 7 | 8 | xhr.addEventListener('readystatechange', function () { 9 | if (this.readyState === this.DONE) { 10 | console.log(this.responseText); 11 | } 12 | }); 13 | 14 | xhr.open('POST', 'http://mockbin.com/har'); 15 | xhr.setRequestHeader('content-type', 'application/json'); 16 | 17 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const data = JSON.stringify({ 2 | foo: null 3 | }); 4 | 5 | const xhr = new XMLHttpRequest(); 6 | xhr.withCredentials = true; 7 | 8 | xhr.addEventListener('readystatechange', function () { 9 | if (this.readyState === this.DONE) { 10 | console.log(this.responseText); 11 | } 12 | }); 13 | 14 | xhr.open('POST', 'http://mockbin.com/har'); 15 | xhr.setRequestHeader('content-type', 'application/json'); 16 | 17 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/multipart-data.js: -------------------------------------------------------------------------------- 1 | const data = new FormData(); 2 | data.append('foo', 'Hello World'); 3 | data.append('bar', 'Bonjour le monde'); 4 | 5 | const xhr = new XMLHttpRequest(); 6 | xhr.withCredentials = true; 7 | 8 | xhr.addEventListener('readystatechange', function () { 9 | if (this.readyState === this.DONE) { 10 | console.log(this.responseText); 11 | } 12 | }); 13 | 14 | xhr.open('POST', 'http://mockbin.com/har'); 15 | 16 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/multipart-file.js: -------------------------------------------------------------------------------- 1 | const data = new FormData(); 2 | data.append('foo', 'test/fixtures/files/hello.txt'); 3 | 4 | const xhr = new XMLHttpRequest(); 5 | xhr.withCredentials = true; 6 | 7 | xhr.addEventListener('readystatechange', function () { 8 | if (this.readyState === this.DONE) { 9 | console.log(this.responseText); 10 | } 11 | }); 12 | 13 | xhr.open('POST', 'http://mockbin.com/har'); 14 | 15 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const xhr = new XMLHttpRequest(); 2 | xhr.withCredentials = true; 3 | 4 | xhr.addEventListener('readystatechange', function () { 5 | if (this.readyState === this.DONE) { 6 | console.log(this.responseText); 7 | } 8 | }); 9 | 10 | xhr.open('POST', 'http://mockbin.com/har'); 11 | xhr.setRequestHeader('Content-Type', 'multipart/form-data'); 12 | 13 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/multipart-form-data.js: -------------------------------------------------------------------------------- 1 | const data = new FormData(); 2 | data.append('foo', 'bar'); 3 | 4 | const xhr = new XMLHttpRequest(); 5 | xhr.withCredentials = true; 6 | 7 | xhr.addEventListener('readystatechange', function () { 8 | if (this.readyState === this.DONE) { 9 | console.log(this.responseText); 10 | } 11 | }); 12 | 13 | xhr.open('POST', 'http://mockbin.com/har'); 14 | 15 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('GET', 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'); 13 | 14 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('GET', 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'); 13 | 14 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const data = null; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('GET', 'http://mockbin.com/har'); 13 | 14 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/javascript/xhr/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const data = 'Hello World'; 2 | 3 | const xhr = new XMLHttpRequest(); 4 | xhr.withCredentials = true; 5 | 6 | xhr.addEventListener('readystatechange', function () { 7 | if (this.readyState === this.DONE) { 8 | console.log(this.responseText); 9 | } 10 | }); 11 | 12 | xhr.open('POST', 'http://mockbin.com/har'); 13 | xhr.setRequestHeader('content-type', 'text/plain'); 14 | 15 | xhr.send(data); -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/application-form-encoded.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val mediaType = MediaType.parse("application/x-www-form-urlencoded") 4 | val body = RequestBody.create(mediaType, "foo=bar&hello=world") 5 | val request = Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "application/x-www-form-urlencoded") 9 | .build() 10 | 11 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/cookies.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .post(null) 6 | .addHeader("cookie", "foo=bar; bar=baz") 7 | .build() 8 | 9 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/custom-method.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .method("PROPFIND", null) 6 | .build() 7 | 8 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/headers.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .get() 6 | .addHeader("accept", "application/json") 7 | .addHeader("x-foo", "Bar") 8 | .addHeader("quoted-value", "\"quoted\" 'string'") 9 | .build() 10 | 11 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/https.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("https://mockbin.com/har") 5 | .get() 6 | .build() 7 | 8 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/jsonObj-multiline.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val mediaType = MediaType.parse("application/json") 4 | val body = RequestBody.create(mediaType, "{\n \"foo\": \"bar\"\n}") 5 | val request = Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "application/json") 9 | .build() 10 | 11 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/jsonObj-null-value.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val mediaType = MediaType.parse("application/json") 4 | val body = RequestBody.create(mediaType, "{\"foo\":null}") 5 | val request = Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "application/json") 9 | .build() 10 | 11 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/multipart-form-data-no-params.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .post(null) 6 | .addHeader("Content-Type", "multipart/form-data") 7 | .build() 8 | 9 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/nested.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 5 | .get() 6 | .build() 7 | 8 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/query.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 5 | .get() 6 | .build() 7 | 8 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/short.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val request = Request.Builder() 4 | .url("http://mockbin.com/har") 5 | .get() 6 | .build() 7 | 8 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/okhttp/fixtures/text-plain.kt: -------------------------------------------------------------------------------- 1 | val client = OkHttpClient() 2 | 3 | val mediaType = MediaType.parse("text/plain") 4 | val body = RequestBody.create(mediaType, "Hello World") 5 | val request = Request.Builder() 6 | .url("http://mockbin.com/har") 7 | .post(body) 8 | .addHeader("content-type", "text/plain") 9 | .build() 10 | 11 | val response = client.newCall(request).execute() -------------------------------------------------------------------------------- /src/targets/kotlin/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { okhttp } from './okhttp/client'; 3 | 4 | export const kotlin: Target = { 5 | info: { 6 | key: 'kotlin', 7 | title: 'Kotlin', 8 | extname: '.kt', 9 | default: 'okhttp', 10 | }, 11 | clientsById: { 12 | okhttp, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {cookie: 'foo=bar; bar=baz'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = {method: 'PROPFIND', url: 'http://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | headers: { 7 | accept: 'application/json', 8 | 'x-foo': 'Bar', 9 | 'quoted-value': '"quoted" \'string\'' 10 | } 11 | }; 12 | 13 | try { 14 | const { data } = await axios.request(options); 15 | console.log(data); 16 | } catch (error) { 17 | console.error(error); 18 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = {method: 'GET', url: 'https://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | data: {foo: 'bar'} 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | data: {foo: null} 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'Content-Type': 'multipart/form-data'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | params: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | params: {foo: ['bar', 'baz'], baz: 'abc', key: 'value'} 7 | }; 8 | 9 | try { 10 | const { data } = await axios.request(options); 11 | console.log(data); 12 | } catch (error) { 13 | console.error(error); 14 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = {method: 'GET', url: 'http://mockbin.com/har'}; 4 | 5 | try { 6 | const { data } = await axios.request(options); 7 | console.log(data); 8 | } catch (error) { 9 | console.error(error); 10 | } -------------------------------------------------------------------------------- /src/targets/node/axios/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default; 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'text/plain'}, 7 | data: 'Hello World' 8 | }; 9 | 10 | try { 11 | const { data } = await axios.request(options); 12 | console.log(data); 13 | } catch (error) { 14 | console.error(error); 15 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = {method: 'POST', headers: {cookie: 'foo=bar; bar=baz'}}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = {method: 'PROPFIND'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'https://mockbin.com/har'; 4 | const options = {method: 'GET'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = { 5 | method: 'POST', 6 | headers: {'content-type': 'application/json'}, 7 | body: '{"foo":"bar"}' 8 | }; 9 | 10 | try { 11 | const response = await fetch(url, options); 12 | const data = await response.json(); 13 | console.log(data); 14 | } catch (error) { 15 | console.error(error); 16 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = { 5 | method: 'POST', 6 | headers: {'content-type': 'application/json'}, 7 | body: '{"foo":null}' 8 | }; 9 | 10 | try { 11 | const response = await fetch(url, options); 12 | const data = await response.json(); 13 | console.log(data); 14 | } catch (error) { 15 | console.error(error); 16 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = {method: 'POST', headers: {'Content-Type': 'multipart/form-data'}}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'; 4 | const options = {method: 'GET'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'; 4 | const options = {method: 'GET'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = {method: 'GET'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/fetch/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch'); 2 | 3 | const url = 'http://mockbin.com/har'; 4 | const options = {method: 'POST', headers: {'content-type': 'text/plain'}, body: 'Hello World'}; 5 | 6 | try { 7 | const response = await fetch(url, options); 8 | const data = await response.json(); 9 | console.log(data); 10 | } catch (error) { 11 | console.error(error); 12 | } -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/application-form-encoded.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/x-www-form-urlencoded'}, 7 | form: {foo: 'bar', hello: 'world'} 8 | }; 9 | 10 | request(options, function (error, response, body) { 11 | if (error) throw new Error(error); 12 | 13 | console.log(body); 14 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const jar = request.jar(); 4 | jar.setCookie(request.cookie('foo=bar'), 'http://mockbin.com/har'); 5 | jar.setCookie(request.cookie('bar=baz'), 'http://mockbin.com/har'); 6 | 7 | const options = {method: 'POST', url: 'http://mockbin.com/har', jar: jar}; 8 | 9 | request(options, function (error, response, body) { 10 | if (error) throw new Error(error); 11 | 12 | console.log(body); 13 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = {method: 'PROPFIND', url: 'http://mockbin.com/har'}; 4 | 5 | request(options, function (error, response, body) { 6 | if (error) throw new Error(error); 7 | 8 | console.log(body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | headers: { 7 | accept: 'application/json', 8 | 'x-foo': 'Bar', 9 | 'quoted-value': '"quoted" \'string\'' 10 | } 11 | }; 12 | 13 | request(options, function (error, response, body) { 14 | if (error) throw new Error(error); 15 | 16 | console.log(body); 17 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = {method: 'GET', url: 'https://mockbin.com/har'}; 4 | 5 | request(options, function (error, response, body) { 6 | if (error) throw new Error(error); 7 | 8 | console.log(body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | body: {foo: 'bar'}, 8 | json: true 9 | }; 10 | 11 | request(options, function (error, response, body) { 12 | if (error) throw new Error(error); 13 | 14 | console.log(body); 15 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'application/json'}, 7 | body: {foo: null}, 8 | json: true 9 | }; 10 | 11 | request(options, function (error, response, body) { 12 | if (error) throw new Error(error); 13 | 14 | console.log(body); 15 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'Content-Type': 'multipart/form-data'} 7 | }; 8 | 9 | request(options, function (error, response, body) { 10 | if (error) throw new Error(error); 11 | 12 | console.log(body); 13 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/multipart-form-data.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001'}, 7 | formData: {foo: 'bar'} 8 | }; 9 | 10 | request(options, function (error, response, body) { 11 | if (error) throw new Error(error); 12 | 13 | console.log(body); 14 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | qs: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} 7 | }; 8 | 9 | request(options, function (error, response, body) { 10 | if (error) throw new Error(error); 11 | 12 | console.log(body); 13 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'GET', 5 | url: 'http://mockbin.com/har', 6 | qs: {foo: ['bar', 'baz'], baz: 'abc', key: 'value'} 7 | }; 8 | 9 | request(options, function (error, response, body) { 10 | if (error) throw new Error(error); 11 | 12 | console.log(body); 13 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = {method: 'GET', url: 'http://mockbin.com/har'}; 4 | 5 | request(options, function (error, response, body) { 6 | if (error) throw new Error(error); 7 | 8 | console.log(body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/request/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const request = require('request'); 2 | 3 | const options = { 4 | method: 'POST', 5 | url: 'http://mockbin.com/har', 6 | headers: {'content-type': 'text/plain'}, 7 | body: 'Hello World' 8 | }; 9 | 10 | request(options, function (error, response, body) { 11 | if (error) throw new Error(error); 12 | 13 | console.log(body); 14 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/application-form-encoded.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'content-type': 'application/x-www-form-urlencoded' 7 | }); 8 | 9 | req.form({ 10 | foo: 'bar', 11 | hello: 'world' 12 | }); 13 | 14 | req.end(function (res) { 15 | if (res.error) throw new Error(res.error); 16 | 17 | console.log(res.body); 18 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/cookies.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | const CookieJar = unirest.jar(); 6 | CookieJar.add('foo=bar', 'http://mockbin.com/har'); 7 | CookieJar.add('bar=baz', 'http://mockbin.com/har'); 8 | req.jar(CookieJar); 9 | 10 | req.end(function (res) { 11 | if (res.error) throw new Error(res.error); 12 | 13 | console.log(res.body); 14 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/custom-method.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('PROPFIND', 'http://mockbin.com/har'); 4 | 5 | req.end(function (res) { 6 | if (res.error) throw new Error(res.error); 7 | 8 | console.log(res.body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/headers.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('GET', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | accept: 'application/json', 7 | 'x-foo': 'Bar', 8 | 'quoted-value': '"quoted" \'string\'' 9 | }); 10 | 11 | req.end(function (res) { 12 | if (res.error) throw new Error(res.error); 13 | 14 | console.log(res.body); 15 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/https.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('GET', 'https://mockbin.com/har'); 4 | 5 | req.end(function (res) { 6 | if (res.error) throw new Error(res.error); 7 | 8 | console.log(res.body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/jsonObj-multiline.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'content-type': 'application/json' 7 | }); 8 | 9 | req.type('json'); 10 | req.send({ 11 | foo: 'bar' 12 | }); 13 | 14 | req.end(function (res) { 15 | if (res.error) throw new Error(res.error); 16 | 17 | console.log(res.body); 18 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/jsonObj-null-value.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'content-type': 'application/json' 7 | }); 8 | 9 | req.type('json'); 10 | req.send({ 11 | foo: null 12 | }); 13 | 14 | req.end(function (res) { 15 | if (res.error) throw new Error(res.error); 16 | 17 | console.log(res.body); 18 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/multipart-form-data-no-params.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'Content-Type': 'multipart/form-data' 7 | }); 8 | 9 | req.end(function (res) { 10 | if (res.error) throw new Error(res.error); 11 | 12 | console.log(res.body); 13 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/multipart-form-data.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001' 7 | }); 8 | 9 | req.multipart([ 10 | { 11 | body: 'bar' 12 | } 13 | ]); 14 | 15 | req.end(function (res) { 16 | if (res.error) throw new Error(res.error); 17 | 18 | console.log(res.body); 19 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('GET', 'http://mockbin.com/har'); 4 | 5 | req.query({ 6 | 'foo[bar]': 'baz,zap', 7 | fiz: 'buz', 8 | key: 'value' 9 | }); 10 | 11 | req.end(function (res) { 12 | if (res.error) throw new Error(res.error); 13 | 14 | console.log(res.body); 15 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/query.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('GET', 'http://mockbin.com/har'); 4 | 5 | req.query({ 6 | foo: [ 7 | 'bar', 8 | 'baz' 9 | ], 10 | baz: 'abc', 11 | key: 'value' 12 | }); 13 | 14 | req.end(function (res) { 15 | if (res.error) throw new Error(res.error); 16 | 17 | console.log(res.body); 18 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/short.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('GET', 'http://mockbin.com/har'); 4 | 5 | req.end(function (res) { 6 | if (res.error) throw new Error(res.error); 7 | 8 | console.log(res.body); 9 | }); -------------------------------------------------------------------------------- /src/targets/node/unirest/fixtures/text-plain.js: -------------------------------------------------------------------------------- 1 | const unirest = require('unirest'); 2 | 3 | const req = unirest('POST', 'http://mockbin.com/har'); 4 | 5 | req.headers({ 6 | 'content-type': 'text/plain' 7 | }); 8 | 9 | req.send('Hello World'); 10 | 11 | req.end(function (res) { 12 | if (res.error) throw new Error(res.error); 13 | 14 | console.log(res.body); 15 | }); -------------------------------------------------------------------------------- /src/targets/objc/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { nsurlsession } from './nsurlsession/client'; 3 | 4 | export const objc: Target = { 5 | info: { 6 | key: 'objc', 7 | title: 'Objective-C', 8 | extname: '.m', 9 | default: 'nsurlsession', 10 | }, 11 | clientsById: { 12 | nsurlsession, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/application-form-encoded.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "content-type" "application/x-www-form-urlencoded" in 7 | let body = Cohttp_lwt_body.of_string "foo=bar&hello=world" in 8 | 9 | Client.call ~headers ~body `POST uri 10 | >>= fun (res, body_stream) -> 11 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/cookies.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "cookie" "foo=bar; bar=baz" in 7 | 8 | Client.call ~headers `POST uri 9 | >>= fun (res, body_stream) -> 10 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/custom-method.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | 7 | Client.call (Code.method_of_string "PROPFIND") uri 8 | >>= fun (res, body_stream) -> 9 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/headers.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add_list (Header.init ()) [ 7 | ("accept", "application/json"); 8 | ("x-foo", "Bar"); 9 | ("quoted-value", "\"quoted\" 'string'"); 10 | ] in 11 | 12 | Client.call ~headers `GET uri 13 | >>= fun (res, body_stream) -> 14 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/https.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "https://mockbin.com/har" in 6 | 7 | Client.call `GET uri 8 | >>= fun (res, body_stream) -> 9 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/jsonObj-multiline.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "content-type" "application/json" in 7 | let body = Cohttp_lwt_body.of_string "{\n \"foo\": \"bar\"\n}" in 8 | 9 | Client.call ~headers ~body `POST uri 10 | >>= fun (res, body_stream) -> 11 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/jsonObj-null-value.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "content-type" "application/json" in 7 | let body = Cohttp_lwt_body.of_string "{\"foo\":null}" in 8 | 9 | Client.call ~headers ~body `POST uri 10 | >>= fun (res, body_stream) -> 11 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/multipart-form-data-no-params.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "Content-Type" "multipart/form-data" in 7 | 8 | Client.call ~headers `POST uri 9 | >>= fun (res, body_stream) -> 10 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/nested.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" in 6 | 7 | Client.call `GET uri 8 | >>= fun (res, body_stream) -> 9 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/query.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value" in 6 | 7 | Client.call `GET uri 8 | >>= fun (res, body_stream) -> 9 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/short.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | 7 | Client.call `GET uri 8 | >>= fun (res, body_stream) -> 9 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/cohttp/fixtures/text-plain.ml: -------------------------------------------------------------------------------- 1 | open Cohttp_lwt_unix 2 | open Cohttp 3 | open Lwt 4 | 5 | let uri = Uri.of_string "http://mockbin.com/har" in 6 | let headers = Header.add (Header.init ()) "content-type" "text/plain" in 7 | let body = Cohttp_lwt_body.of_string "Hello World" in 8 | 9 | Client.call ~headers ~body `POST uri 10 | >>= fun (res, body_stream) -> 11 | (* Do stuff with the result *) -------------------------------------------------------------------------------- /src/targets/ocaml/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { cohttp } from './cohttp/client'; 3 | 4 | export const ocaml: Target = { 5 | info: { 6 | key: 'ocaml', 7 | title: 'OCaml', 8 | extname: '.ml', 9 | default: 'cohttp', 10 | }, 11 | clientsById: { 12 | cohttp, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/application-form-encoded.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'form_params' => [ 7 | 'foo' => 'bar', 8 | 'hello' => 'world' 9 | ], 10 | 'headers' => [ 11 | 'content-type' => 'application/x-www-form-urlencoded', 12 | ], 13 | ]); 14 | 15 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/application-json.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'body' => '{"number":1,"string":"f\\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}', 7 | 'headers' => [ 8 | 'content-type' => 'application/json', 9 | ], 10 | ]); 11 | 12 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/cookies.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'headers' => [ 7 | 'cookie' => 'foo=bar; bar=baz', 8 | ], 9 | ]); 10 | 11 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/custom-method.php: -------------------------------------------------------------------------------- 1 | request('PROPFIND', 'http://mockbin.com/har'); 6 | 7 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/full.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value', [ 6 | 'form_params' => [ 7 | 'foo' => 'bar' 8 | ], 9 | 'headers' => [ 10 | 'accept' => 'application/json', 11 | 'content-type' => 'application/x-www-form-urlencoded', 12 | 'cookie' => 'foo=bar; bar=baz', 13 | ], 14 | ]); 15 | 16 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/headers.php: -------------------------------------------------------------------------------- 1 | request('GET', 'http://mockbin.com/har', [ 6 | 'headers' => [ 7 | 'accept' => 'application/json', 8 | 'quoted-value' => '"quoted" \'string\'', 9 | 'x-foo' => 'Bar', 10 | ], 11 | ]); 12 | 13 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/https.php: -------------------------------------------------------------------------------- 1 | request('GET', 'https://mockbin.com/har'); 6 | 7 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/jsonObj-multiline.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'body' => '{ 7 | "foo": "bar" 8 | }', 9 | 'headers' => [ 10 | 'content-type' => 'application/json', 11 | ], 12 | ]); 13 | 14 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/jsonObj-null-value.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'body' => '{"foo":null}', 7 | 'headers' => [ 8 | 'content-type' => 'application/json', 9 | ], 10 | ]); 11 | 12 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/multipart-file.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'multipart' => [ 7 | [ 8 | 'name' => 'foo', 9 | 'filename' => 'test/fixtures/files/hello.txt', 10 | 'contents' => null, 11 | 'headers' => [ 12 | 'Content-Type' => 'text/plain' 13 | ] 14 | ] 15 | ] 16 | ]); 17 | 18 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/multipart-form-data-no-params.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'headers' => [ 7 | 'Content-Type' => 'multipart/form-data', 8 | ], 9 | ]); 10 | 11 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/multipart-form-data.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'multipart' => [ 7 | [ 8 | 'name' => 'foo', 9 | 'contents' => 'bar' 10 | ] 11 | ] 12 | ]); 13 | 14 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/nested.php: -------------------------------------------------------------------------------- 1 | request('GET', 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'); 6 | 7 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/query.php: -------------------------------------------------------------------------------- 1 | request('GET', 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'); 6 | 7 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/short.php: -------------------------------------------------------------------------------- 1 | request('GET', 'http://mockbin.com/har'); 6 | 7 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/guzzle/fixtures/text-plain.php: -------------------------------------------------------------------------------- 1 | request('POST', 'http://mockbin.com/har', [ 6 | 'body' => 'Hello World', 7 | 'headers' => [ 8 | 'content-type' => 'text/plain', 9 | ], 10 | ]); 11 | 12 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/cookies.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_POST); 6 | 7 | $request->setCookies([ 8 | 'bar' => 'baz', 9 | 'foo' => 'bar' 10 | ]); 11 | 12 | try { 13 | $response = $request->send(); 14 | 15 | echo $response->getBody(); 16 | } catch (HttpException $ex) { 17 | echo $ex; 18 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/custom-method.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_PROPFIND); 6 | 7 | try { 8 | $response = $request->send(); 9 | 10 | echo $response->getBody(); 11 | } catch (HttpException $ex) { 12 | echo $ex; 13 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/headers.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_GET); 6 | 7 | $request->setHeaders([ 8 | 'accept' => 'application/json', 9 | 'x-foo' => 'Bar', 10 | 'quoted-value' => '"quoted" \'string\'' 11 | ]); 12 | 13 | try { 14 | $response = $request->send(); 15 | 16 | echo $response->getBody(); 17 | } catch (HttpException $ex) { 18 | echo $ex; 19 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/https.php: -------------------------------------------------------------------------------- 1 | setUrl('https://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_GET); 6 | 7 | try { 8 | $response = $request->send(); 9 | 10 | echo $response->getBody(); 11 | } catch (HttpException $ex) { 12 | echo $ex; 13 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/multipart-form-data-no-params.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_POST); 6 | 7 | $request->setHeaders([ 8 | 'Content-Type' => 'multipart/form-data' 9 | ]); 10 | 11 | try { 12 | $response = $request->send(); 13 | 14 | echo $response->getBody(); 15 | } catch (HttpException $ex) { 16 | echo $ex; 17 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/nested.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_GET); 6 | 7 | $request->setQueryData([ 8 | 'foo[bar]' => 'baz,zap', 9 | 'fiz' => 'buz', 10 | 'key' => 'value' 11 | ]); 12 | 13 | try { 14 | $response = $request->send(); 15 | 16 | echo $response->getBody(); 17 | } catch (HttpException $ex) { 18 | echo $ex; 19 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/query.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_GET); 6 | 7 | $request->setQueryData([ 8 | 'foo' => [ 9 | 'bar', 10 | 'baz' 11 | ], 12 | 'baz' => 'abc', 13 | 'key' => 'value' 14 | ]); 15 | 16 | try { 17 | $response = $request->send(); 18 | 19 | echo $response->getBody(); 20 | } catch (HttpException $ex) { 21 | echo $ex; 22 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/short.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_GET); 6 | 7 | try { 8 | $response = $request->send(); 9 | 10 | echo $response->getBody(); 11 | } catch (HttpException $ex) { 12 | echo $ex; 13 | } -------------------------------------------------------------------------------- /src/targets/php/http1/fixtures/text-plain.php: -------------------------------------------------------------------------------- 1 | setUrl('http://mockbin.com/har'); 5 | $request->setMethod(HTTP_METH_POST); 6 | 7 | $request->setHeaders([ 8 | 'content-type' => 'text/plain' 9 | ]); 10 | 11 | $request->setBody('Hello World'); 12 | 13 | try { 14 | $response = $request->send(); 15 | 16 | echo $response->getBody(); 17 | } catch (HttpException $ex) { 18 | echo $ex; 19 | } -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/cookies.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('POST'); 8 | 9 | $client->setCookies([ 10 | 'bar' => 'baz', 11 | 'foo' => 'bar' 12 | ]); 13 | 14 | $client->enqueue($request)->send(); 15 | $response = $client->getResponse(); 16 | 17 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/custom-method.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('PROPFIND'); 8 | $client->enqueue($request)->send(); 9 | $response = $client->getResponse(); 10 | 11 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/headers.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('GET'); 8 | $request->setHeaders([ 9 | 'accept' => 'application/json', 10 | 'x-foo' => 'Bar', 11 | 'quoted-value' => '"quoted" \'string\'' 12 | ]); 13 | 14 | $client->enqueue($request)->send(); 15 | $response = $client->getResponse(); 16 | 17 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/https.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('https://mockbin.com/har'); 7 | $request->setRequestMethod('GET'); 8 | $client->enqueue($request)->send(); 9 | $response = $client->getResponse(); 10 | 11 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/multipart-form-data-no-params.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('POST'); 8 | $request->setHeaders([ 9 | 'Content-Type' => 'multipart/form-data' 10 | ]); 11 | 12 | $client->enqueue($request)->send(); 13 | $response = $client->getResponse(); 14 | 15 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/multipart-form-data.php: -------------------------------------------------------------------------------- 1 | addForm([ 8 | 'foo' => 'bar' 9 | ], null); 10 | 11 | $request->setRequestUrl('http://mockbin.com/har'); 12 | $request->setRequestMethod('POST'); 13 | $request->setBody($body); 14 | 15 | $client->enqueue($request)->send(); 16 | $response = $client->getResponse(); 17 | 18 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/nested.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('GET'); 8 | $request->setQuery(new http\QueryString([ 9 | 'foo[bar]' => 'baz,zap', 10 | 'fiz' => 'buz', 11 | 'key' => 'value' 12 | ])); 13 | 14 | $client->enqueue($request)->send(); 15 | $response = $client->getResponse(); 16 | 17 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/php/http2/fixtures/short.php: -------------------------------------------------------------------------------- 1 | setRequestUrl('http://mockbin.com/har'); 7 | $request->setRequestMethod('GET'); 8 | $client->enqueue($request)->send(); 9 | $response = $client->getResponse(); 10 | 11 | echo $response->getBody(); -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/application-form-encoded.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/x-www-form-urlencoded") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'foo=bar&hello=world' -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/application-json.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}' -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/custom-method.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -CustomMethod PROPFIND -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/headers.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("accept", "application/json") 3 | $headers.Add("x-foo", "Bar") 4 | $headers.Add("quoted-value", "`"quoted`" 'string'") 5 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method GET -Headers $headers -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/https.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-RestMethod -Uri 'https://mockbin.com/har' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/jsonObj-multiline.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{ 4 | "foo": "bar" 5 | }' -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/jsonObj-null-value.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"foo":null}' -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/multipart-form-data-no-params.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("Content-Type", "multipart/form-data") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/multipart-form-data.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001 4 | Content-Disposition: form-data; name="foo" 5 | 6 | bar 7 | -----011000010111000001101001-- 8 | ' -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/nested.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/query.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/short.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/restmethod/fixtures/text-plain.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "text/plain") 3 | $response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'text/plain' -Body 'Hello World' -------------------------------------------------------------------------------- /src/targets/powershell/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { restmethod } from './restmethod/client'; 3 | import { webrequest } from './webrequest/client'; 4 | 5 | export const powershell: Target = { 6 | info: { 7 | key: 'powershell', 8 | title: 'Powershell', 9 | extname: '.ps1', 10 | default: 'webrequest', 11 | }, 12 | clientsById: { 13 | webrequest, 14 | restmethod, 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/application-form-encoded.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/x-www-form-urlencoded") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'foo=bar&hello=world' -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/application-json.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}' -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/custom-method.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -CustomMethod PROPFIND -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/headers.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("accept", "application/json") 3 | $headers.Add("x-foo", "Bar") 4 | $headers.Add("quoted-value", "`"quoted`" 'string'") 5 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method GET -Headers $headers -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/https.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-WebRequest -Uri 'https://mockbin.com/har' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/jsonObj-multiline.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{ 4 | "foo": "bar" 5 | }' -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/jsonObj-null-value.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "application/json") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"foo":null}' -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/multipart-form-data-no-params.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("Content-Type", "multipart/form-data") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/multipart-form-data.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001 4 | Content-Disposition: form-data; name="foo" 5 | 6 | bar 7 | -----011000010111000001101001-- 8 | ' -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/nested.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/query.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/short.ps1: -------------------------------------------------------------------------------- 1 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method GET -------------------------------------------------------------------------------- /src/targets/powershell/webrequest/fixtures/text-plain.ps1: -------------------------------------------------------------------------------- 1 | $headers=@{} 2 | $headers.Add("content-type", "text/plain") 3 | $response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'text/plain' -Body 'Hello World' -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/application-form-encoded.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | payload = "foo=bar&hello=world" 6 | 7 | headers = { 'content-type': "application/x-www-form-urlencoded" } 8 | 9 | conn.request("POST", "/har", payload, headers) 10 | 11 | res = conn.getresponse() 12 | data = res.read() 13 | 14 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/cookies.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | headers = { 'cookie': "foo=bar; bar=baz" } 6 | 7 | conn.request("POST", "/har", headers=headers) 8 | 9 | res = conn.getresponse() 10 | data = res.read() 11 | 12 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/custom-method.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | conn.request("PROPFIND", "/har") 6 | 7 | res = conn.getresponse() 8 | data = res.read() 9 | 10 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/headers.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | headers = { 6 | 'accept': "application/json", 7 | 'x-foo': "Bar", 8 | 'quoted-value': "\"quoted\" 'string'" 9 | } 10 | 11 | conn.request("GET", "/har", headers=headers) 12 | 13 | res = conn.getresponse() 14 | data = res.read() 15 | 16 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/https.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPSConnection("mockbin.com") 4 | 5 | conn.request("GET", "/har") 6 | 7 | res = conn.getresponse() 8 | data = res.read() 9 | 10 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/insecure-skip-verify.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | import ssl 3 | 4 | conn = http.client.HTTPSConnection("mockbin.com", context = ssl._create_unverified_context()) 5 | 6 | conn.request("GET", "/har") 7 | 8 | res = conn.getresponse() 9 | data = res.read() 10 | 11 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/jsonObj-multiline.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | payload = "{\n \"foo\": \"bar\"\n}" 6 | 7 | headers = { 'content-type': "application/json" } 8 | 9 | conn.request("POST", "/har", payload, headers) 10 | 11 | res = conn.getresponse() 12 | data = res.read() 13 | 14 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/jsonObj-null-value.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | payload = "{\"foo\":null}" 6 | 7 | headers = { 'content-type': "application/json" } 8 | 9 | conn.request("POST", "/har", payload, headers) 10 | 11 | res = conn.getresponse() 12 | data = res.read() 13 | 14 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/multipart-form-data-no-params.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | payload = "" 6 | 7 | headers = { 'Content-Type': "multipart/form-data" } 8 | 9 | conn.request("POST", "/har", payload, headers) 10 | 11 | res = conn.getresponse() 12 | data = res.read() 13 | 14 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/nested.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | conn.request("GET", "/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 6 | 7 | res = conn.getresponse() 8 | data = res.read() 9 | 10 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/query.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | conn.request("GET", "/har?foo=bar&foo=baz&baz=abc&key=value") 6 | 7 | res = conn.getresponse() 8 | data = res.read() 9 | 10 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/short.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | conn.request("GET", "/har") 6 | 7 | res = conn.getresponse() 8 | data = res.read() 9 | 10 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/python3/fixtures/text-plain.py: -------------------------------------------------------------------------------- 1 | import http.client 2 | 3 | conn = http.client.HTTPConnection("mockbin.com") 4 | 5 | payload = "Hello World" 6 | 7 | headers = { 'content-type': "text/plain" } 8 | 9 | conn.request("POST", "/har", payload, headers) 10 | 11 | res = conn.getresponse() 12 | data = res.read() 13 | 14 | print(data.decode("utf-8")) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/application-form-encoded.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = { 6 | "foo": "bar", 7 | "hello": "world" 8 | } 9 | headers = {"content-type": "application/x-www-form-urlencoded"} 10 | 11 | response = requests.post(url, data=payload, headers=headers) 12 | 13 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/application-json.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = { 6 | "number": 1, 7 | "string": "f\"oo", 8 | "arr": [1, 2, 3], 9 | "nested": { "a": "b" }, 10 | "arr_mix": [1, "a", { "arr_mix_nested": {} }], 11 | "boolean": False 12 | } 13 | headers = {"content-type": "application/json"} 14 | 15 | response = requests.post(url, json=payload, headers=headers) 16 | 17 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/cookies.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | headers = {"cookie": "foo=bar; bar=baz"} 6 | 7 | response = requests.post(url, headers=headers) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/custom-method.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | response = requests.request("PROPFIND", url) 6 | 7 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/full.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | querystring = {"foo":["bar","baz"],"baz":"abc","key":"value"} 6 | 7 | payload = { "foo": "bar" } 8 | headers = { 9 | "cookie": "foo=bar; bar=baz", 10 | "accept": "application/json", 11 | "content-type": "application/x-www-form-urlencoded" 12 | } 13 | 14 | response = requests.post(url, data=payload, headers=headers, params=querystring) 15 | 16 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/headers.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | headers = { 6 | "accept": "application/json", 7 | "x-foo": "Bar", 8 | "quoted-value": "\"quoted\" 'string'" 9 | } 10 | 11 | response = requests.get(url, headers=headers) 12 | 13 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/https.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "https://mockbin.com/har" 4 | 5 | response = requests.get(url) 6 | 7 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/jsonObj-multiline.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = { "foo": "bar" } 6 | headers = {"content-type": "application/json"} 7 | 8 | response = requests.post(url, json=payload, headers=headers) 9 | 10 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/jsonObj-null-value.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = { "foo": None } 6 | headers = {"content-type": "application/json"} 7 | 8 | response = requests.post(url, json=payload, headers=headers) 9 | 10 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/multipart-data.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | files = { "foo": "open('hello.txt', 'rb')" } 6 | payload = { "bar": "Bonjour le monde" } 7 | 8 | response = requests.post(url, data=payload, files=files) 9 | 10 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/multipart-file.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | files = { "foo": "open('test/fixtures/files/hello.txt', 'rb')" } 6 | 7 | response = requests.post(url, files=files) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/multipart-form-data-no-params.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | headers = {"Content-Type": "multipart/form-data"} 6 | 7 | response = requests.post(url, headers=headers) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/multipart-form-data.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n" 6 | headers = {"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"} 7 | 8 | response = requests.post(url, data=payload, headers=headers) 9 | 10 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/nested.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | querystring = {"foo[bar]":"baz,zap","fiz":"buz","key":"value"} 6 | 7 | response = requests.get(url, params=querystring) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/query-params.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | querystring = {"param":"value"} 6 | 7 | response = requests.get(url, params=querystring) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/query.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | querystring = {"foo":["bar","baz"],"baz":"abc","key":"value"} 6 | 7 | response = requests.get(url, params=querystring) 8 | 9 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/short.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | response = requests.get(url) 6 | 7 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/requests/fixtures/text-plain.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://mockbin.com/har" 4 | 5 | payload = "Hello World" 6 | headers = {"content-type": "text/plain"} 7 | 8 | response = requests.post(url, data=payload, headers=headers) 9 | 10 | print(response.json()) -------------------------------------------------------------------------------- /src/targets/python/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { python3 } from './python3/client'; 3 | import { requests } from './requests/client'; 4 | 5 | export const python: Target = { 6 | info: { 7 | key: 'python', 8 | title: 'Python', 9 | extname: '.py', 10 | default: 'python3', 11 | }, 12 | clientsById: { 13 | python3, 14 | requests, 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/application-form-encoded.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "foo=bar&hello=world" 6 | 7 | encode <- "form" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/application-json.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}" 6 | 7 | encode <- "json" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/cookies.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | response <- VERB("POST", url, content_type("application/octet-stream"), set_cookies(`foo` = "bar", `bar` = "baz")) 6 | 7 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/custom-method.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | response <- VERB("PROPFIND", url, content_type("application/octet-stream")) 6 | 7 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/full.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | queryString <- list( 6 | foo = "bar,baz", 7 | baz = "abc" 8 | ) 9 | 10 | payload <- "foo=bar" 11 | 12 | encode <- "form" 13 | 14 | response <- VERB("POST", url, body = payload, query = queryString, content_type("application/x-www-form-urlencoded"), accept("application/json"), set_cookies(`foo` = "bar", `bar` = "baz"), encode = encode) 15 | 16 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/headers.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | response <- VERB("GET", url, add_headers('x-foo' = 'Bar', 'quoted-value' = '"quoted" \'string\''), content_type("application/octet-stream"), accept("application/json")) 6 | 7 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/https.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "https://mockbin.com/har" 4 | 5 | response <- VERB("GET", url, content_type("application/octet-stream")) 6 | 7 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/jsonObj-multiline.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "{\n \"foo\": \"bar\"\n}" 6 | 7 | encode <- "json" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/jsonObj-null-value.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "{\"foo\":null}" 6 | 7 | encode <- "json" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/multipart-file.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n-----011000010111000001101001--\r\n" 6 | 7 | encode <- "multipart" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/multipart-form-data-no-params.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "" 6 | 7 | response <- VERB("POST", url, body = payload, content_type("multipart/form-data")) 8 | 9 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/multipart-form-data.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n" 6 | 7 | encode <- "multipart" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/nested.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | queryString <- list( 6 | foo[bar] = "baz,zap", 7 | fiz = "buz" 8 | ) 9 | 10 | response <- VERB("GET", url, query = queryString, content_type("application/octet-stream")) 11 | 12 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/query-two-params.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | queryString <- list( 6 | perPage = "100", 7 | page = "1" 8 | ) 9 | 10 | response <- VERB("GET", url, query = queryString, content_type("application/octet-stream")) 11 | 12 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/query.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | queryString <- list( 6 | foo = "bar,baz", 7 | baz = "abc" 8 | ) 9 | 10 | response <- VERB("GET", url, query = queryString, content_type("application/octet-stream")) 11 | 12 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/short.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | response <- VERB("GET", url, content_type("application/octet-stream")) 6 | 7 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/httr/fixtures/text-plain.r: -------------------------------------------------------------------------------- 1 | library(httr) 2 | 3 | url <- "http://mockbin.com/har" 4 | 5 | payload <- "Hello World" 6 | 7 | encode <- "raw" 8 | 9 | response <- VERB("POST", url, body = payload, content_type("text/plain"), encode = encode) 10 | 11 | content(response, "text") -------------------------------------------------------------------------------- /src/targets/r/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { httr } from './httr/client'; 3 | 4 | export const r: Target = { 5 | info: { 6 | key: 'r', 7 | title: 'R', 8 | extname: '.r', 9 | default: 'httr', 10 | }, 11 | clientsById: { 12 | httr, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/application-form-encoded.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | data = { 4 | :foo => "bar", 5 | :hello => "world", 6 | } 7 | 8 | conn = Faraday.new( 9 | url: 'http://mockbin.com', 10 | headers: {'Content-Type' => 'application/x-www-form-urlencoded'} 11 | ) 12 | 13 | response = conn.post('/har') do |req| 14 | req.body = URI.encode_www_form(data) 15 | end 16 | 17 | puts response.status 18 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/application-json.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'application/json'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | req.body = "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}" 10 | end 11 | 12 | puts response.status 13 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/cookies.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | ) 6 | 7 | response = conn.post('/har') do |req| 8 | req.headers['cookie'] = 'foo=bar; bar=baz' 9 | end 10 | 11 | puts response.status 12 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/custom-method.rb: -------------------------------------------------------------------------------- 1 | # Faraday cannot currently run PROPFIND requests. Please use another client. -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/headers.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | ) 6 | 7 | response = conn.get('/har') do |req| 8 | req.headers['accept'] = 'application/json' 9 | req.headers['x-foo'] = 'Bar' 10 | req.headers['quoted-value'] = '"quoted" \'string\'' 11 | end 12 | 13 | puts response.status 14 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/https.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'https://mockbin.com', 5 | ) 6 | 7 | response = conn.get('/har') do |req| 8 | end 9 | 10 | puts response.status 11 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/jsonObj-multiline.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'application/json'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | req.body = "{\n \"foo\": \"bar\"\n}" 10 | end 11 | 12 | puts response.status 13 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/jsonObj-null-value.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'application/json'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | req.body = "{\"foo\":null}" 10 | end 11 | 12 | puts response.status 13 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/multipart-form-data-no-params.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'multipart/form-data'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | end 10 | 11 | puts response.status 12 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/multipart-form-data.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n" 10 | end 11 | 12 | puts response.status 13 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/nested.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | ) 6 | 7 | response = conn.get('/har') do |req| 8 | req.params['foo[bar]'] = 'baz,zap' 9 | req.params['fiz'] = 'buz' 10 | req.params['key'] = 'value' 11 | end 12 | 13 | puts response.status 14 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/query.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | ) 6 | 7 | response = conn.get('/har') do |req| 8 | req.params['foo'] = ["bar","baz"] 9 | req.params['baz'] = 'abc' 10 | req.params['key'] = 'value' 11 | end 12 | 13 | puts response.status 14 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/short.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | ) 6 | 7 | response = conn.get('/har') do |req| 8 | end 9 | 10 | puts response.status 11 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/faraday/fixtures/text-plain.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | conn = Faraday.new( 4 | url: 'http://mockbin.com', 5 | headers: {'Content-Type' => 'text/plain'} 6 | ) 7 | 8 | response = conn.post('/har') do |req| 9 | req.body = "Hello World" 10 | end 11 | 12 | puts response.status 13 | puts response.body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/application-form-encoded.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["content-type"] = 'application/x-www-form-urlencoded' 10 | request.body = "foo=bar&hello=world" 11 | 12 | response = http.request(request) 13 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/cookies.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["cookie"] = 'foo=bar; bar=baz' 10 | 11 | response = http.request(request) 12 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/custom-method.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | class Net::HTTP::Propfind < Net::HTTPRequest 5 | METHOD = 'PROPFIND' 6 | REQUEST_HAS_BODY = 'false' 7 | RESPONSE_HAS_BODY = true 8 | end 9 | 10 | url = URI("http://mockbin.com/har") 11 | 12 | http = Net::HTTP.new(url.host, url.port) 13 | 14 | request = Net::HTTP::Propfind.new(url) 15 | 16 | response = http.request(request) 17 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/headers.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Get.new(url) 9 | request["accept"] = 'application/json' 10 | request["x-foo"] = 'Bar' 11 | request["quoted-value"] = '"quoted" \'string\'' 12 | 13 | response = http.request(request) 14 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/https.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("https://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | http.use_ssl = true 8 | 9 | request = Net::HTTP::Get.new(url) 10 | 11 | response = http.request(request) 12 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/insecure-skip-verify.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("https://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | http.use_ssl = true 8 | http.verify_mode = OpenSSL::SSL::VERIFY_NONE 9 | 10 | request = Net::HTTP::Get.new(url) 11 | 12 | response = http.request(request) 13 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/jsonObj-multiline.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["content-type"] = 'application/json' 10 | request.body = "{\n \"foo\": \"bar\"\n}" 11 | 12 | response = http.request(request) 13 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/jsonObj-null-value.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["content-type"] = 'application/json' 10 | request.body = "{\"foo\":null}" 11 | 12 | response = http.request(request) 13 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/multipart-form-data-no-params.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["Content-Type"] = 'multipart/form-data' 10 | 11 | response = http.request(request) 12 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/nested.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Get.new(url) 9 | 10 | response = http.request(request) 11 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/query.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Get.new(url) 9 | 10 | response = http.request(request) 11 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/short.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Get.new(url) 9 | 10 | response = http.request(request) 11 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/native/fixtures/text-plain.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'net/http' 3 | 4 | url = URI("http://mockbin.com/har") 5 | 6 | http = Net::HTTP.new(url.host, url.port) 7 | 8 | request = Net::HTTP::Post.new(url) 9 | request["content-type"] = 'text/plain' 10 | request.body = "Hello World" 11 | 12 | response = http.request(request) 13 | puts response.read_body -------------------------------------------------------------------------------- /src/targets/ruby/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { faraday } from './faraday/client'; 3 | import { native } from './native/client'; 4 | 5 | export const ruby: Target = { 6 | info: { 7 | key: 'ruby', 8 | title: 'Ruby', 9 | extname: '.rb', 10 | default: 'native', 11 | }, 12 | clientsById: { 13 | native, 14 | faraday, 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /src/targets/rust/reqwest/fixtures/https.rs: -------------------------------------------------------------------------------- 1 | use reqwest; 2 | 3 | #[tokio::main] 4 | pub async fn main() { 5 | let url = "https://mockbin.com/har"; 6 | 7 | let client = reqwest::Client::new(); 8 | let response = client.get(url) 9 | .send() 10 | .await; 11 | 12 | let results = response.unwrap() 13 | .json::() 14 | .await 15 | .unwrap(); 16 | 17 | dbg!(results); 18 | } 19 | -------------------------------------------------------------------------------- /src/targets/rust/reqwest/fixtures/short.rs: -------------------------------------------------------------------------------- 1 | use reqwest; 2 | 3 | #[tokio::main] 4 | pub async fn main() { 5 | let url = "http://mockbin.com/har"; 6 | 7 | let client = reqwest::Client::new(); 8 | let response = client.get(url) 9 | .send() 10 | .await; 11 | 12 | let results = response.unwrap() 13 | .json::() 14 | .await 15 | .unwrap(); 16 | 17 | dbg!(results); 18 | } 19 | -------------------------------------------------------------------------------- /src/targets/rust/target.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../targets'; 2 | import { reqwest } from './reqwest/client'; 3 | 4 | export const rust: Target = { 5 | info: { 6 | key: 'rust', 7 | title: 'Rust', 8 | extname: '.rs', 9 | default: 'reqwest', 10 | }, 11 | clientsById: { 12 | reqwest, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/accept-encoding-compressed.sh: -------------------------------------------------------------------------------- 1 | curl --request GET \ 2 | --url http://mockbin.com/har \ 3 | --compressed \ 4 | --header 'accept-encoding: deflate, gzip, br' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/application-form-encoded.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/x-www-form-urlencoded' \ 4 | --data foo=bar \ 5 | --data hello=world -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/application-json-prettified.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/json' \ 4 | --data ' 5 | { 6 | "number": 1, 7 | "string": "f\"oo", 8 | "arr": [ 9 | 1, 10 | 2, 11 | 3 12 | ], 13 | "nested": { 14 | "a": "b" 15 | }, 16 | "arr_mix": [ 17 | 1, 18 | "a", 19 | { 20 | "arr_mix_nested": {} 21 | } 22 | ], 23 | "boolean": false 24 | } 25 | ' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/application-json.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/json' \ 4 | --data '{"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/binary-option.sh: -------------------------------------------------------------------------------- 1 | curl -X POST 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value' -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' -b 'foo=bar; bar=baz' --data-binary foo=bar -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/cookies.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --cookie 'foo=bar; bar=baz' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/custom-indentation.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | @--url 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value' \ 3 | @--header 'accept: application/json' \ 4 | @--header 'content-type: application/x-www-form-urlencoded' \ 5 | @--cookie 'foo=bar; bar=baz' \ 6 | @--data foo=bar -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/custom-method.sh: -------------------------------------------------------------------------------- 1 | curl --request PROPFIND \ 2 | --url http://mockbin.com/har -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/dont-deglob.sh: -------------------------------------------------------------------------------- 1 | curl --request GET --url 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/full.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value' \ 3 | --header 'accept: application/json' \ 4 | --header 'content-type: application/x-www-form-urlencoded' \ 5 | --cookie 'foo=bar; bar=baz' \ 6 | --data foo=bar -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/globoff-option.sh: -------------------------------------------------------------------------------- 1 | curl -X GET -g 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/headers.sh: -------------------------------------------------------------------------------- 1 | curl --request GET \ 2 | --url http://mockbin.com/har \ 3 | --header 'accept: application/json' \ 4 | --header 'quoted-value: "quoted" '\''string'\''' \ 5 | --header 'x-foo: Bar' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/http1.sh: -------------------------------------------------------------------------------- 1 | curl --request GET \ 2 | --url "http://mockbin.com/request" \ 3 | --http1.0 -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/http10.sh: -------------------------------------------------------------------------------- 1 | curl --request GET --url http://mockbin.com/request --http1.0 -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/https.sh: -------------------------------------------------------------------------------- 1 | curl --request GET \ 2 | --url https://mockbin.com/har -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/insecure-skip-verify.sh: -------------------------------------------------------------------------------- 1 | curl --request GET \ 2 | --url https://mockbin.com/har \ 3 | --insecure -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/jsonObj-multiline.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/json' \ 4 | --data '{ 5 | "foo": "bar" 6 | }' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/jsonObj-null-value.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/json' \ 4 | --data '{"foo":null}' -------------------------------------------------------------------------------- /src/targets/shell/curl/fixtures/jsonObj-with-singlequotes.sh: -------------------------------------------------------------------------------- 1 | curl --request POST \ 2 | --url http://mockbin.com/har \ 3 | --header 'content-type: application/json' \ 4 | --data @- <