@readme/httpsnippet 3.1.3 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -62
- package/dist/package.json +86 -0
- package/dist/src/fixtures/customTarget.js +15 -0
- package/dist/src/fixtures/mimetypes.js +77 -0
- package/dist/src/fixtures/requests/application-form-encoded.js +69 -0
- package/dist/src/fixtures/requests/application-json.js +72 -0
- package/dist/src/fixtures/requests/cookies.js +51 -0
- package/dist/src/fixtures/requests/custom-method.js +41 -0
- package/dist/src/fixtures/requests/full.js +99 -0
- package/dist/src/fixtures/requests/headers.js +56 -0
- package/dist/src/fixtures/requests/http-insecure.js +45 -0
- package/dist/src/fixtures/requests/jsonObj-multiline.js +59 -0
- package/dist/src/fixtures/requests/jsonObj-null-value.js +61 -0
- package/dist/src/fixtures/requests/multipart-data.js +72 -0
- package/dist/src/fixtures/requests/multipart-file.js +65 -0
- package/dist/src/fixtures/requests/multipart-form-data-no-params.js +56 -0
- package/dist/src/fixtures/requests/multipart-form-data.js +64 -0
- package/dist/src/fixtures/requests/nested.js +64 -0
- package/dist/src/fixtures/requests/query-encoded.js +59 -0
- package/dist/src/fixtures/requests/query.js +64 -0
- package/dist/src/fixtures/requests/short.js +45 -0
- package/dist/src/fixtures/requests/text-plain.js +57 -0
- package/dist/src/fixtures/runCustomFixtures.js +77 -0
- package/dist/src/helpers/code-builder.js +91 -0
- package/dist/src/helpers/form-data.js +157 -0
- package/dist/src/helpers/har-validator.js +76 -0
- package/dist/src/helpers/headers.js +33 -0
- package/dist/src/helpers/reducer.js +19 -0
- package/dist/src/helpers/shell.js +20 -0
- package/dist/src/helpers/utils.js +21 -0
- package/dist/src/index.js +285 -0
- package/dist/src/targets/c/libcurl/client.js +43 -0
- package/dist/src/targets/c/target.js +15 -0
- package/dist/src/targets/clojure/clj_http/client.js +184 -0
- package/dist/src/targets/clojure/target.js +15 -0
- package/dist/src/targets/csharp/httpclient/client.js +162 -0
- package/dist/src/targets/csharp/restsharp/client.js +38 -0
- package/dist/src/targets/csharp/target.js +17 -0
- package/dist/src/targets/go/native/client.js +122 -0
- package/dist/src/targets/go/target.js +15 -0
- package/dist/src/targets/http/http1.1/client.js +79 -0
- package/dist/src/targets/http/target.js +15 -0
- package/dist/src/targets/java/asynchttp/client.js +53 -0
- package/dist/src/targets/java/nethttp/client.js +52 -0
- package/dist/src/targets/java/okhttp/client.js +79 -0
- package/dist/src/targets/java/target.js +21 -0
- package/dist/src/targets/java/unirest/client.js +53 -0
- package/dist/src/targets/javascript/axios/client.js +101 -0
- package/dist/src/targets/javascript/axios/fixtures/application-form-encoded.js +22 -0
- package/dist/src/targets/javascript/axios/fixtures/application-json.js +26 -0
- package/dist/src/targets/javascript/axios/fixtures/cookies.js +18 -0
- package/dist/src/targets/javascript/axios/fixtures/custom-method.js +14 -0
- package/dist/src/targets/javascript/axios/fixtures/full.js +26 -0
- package/dist/src/targets/javascript/axios/fixtures/headers.js +18 -0
- package/dist/src/targets/javascript/axios/fixtures/http-insecure.js +14 -0
- package/dist/src/targets/javascript/axios/fixtures/jsonObj-multiline.js +19 -0
- package/dist/src/targets/javascript/axios/fixtures/jsonObj-null-value.js +19 -0
- package/dist/src/targets/javascript/axios/fixtures/multipart-data.js +22 -0
- package/dist/src/targets/javascript/axios/fixtures/multipart-file.js +21 -0
- package/dist/src/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +18 -0
- package/dist/src/targets/javascript/axios/fixtures/multipart-form-data.js +21 -0
- package/dist/src/targets/javascript/axios/fixtures/nested.js +18 -0
- package/dist/src/targets/javascript/axios/fixtures/query-encoded.js +21 -0
- package/dist/src/targets/javascript/axios/fixtures/query.js +18 -0
- package/dist/src/targets/javascript/axios/fixtures/short.js +14 -0
- package/dist/src/targets/javascript/axios/fixtures/text-plain.js +19 -0
- package/dist/src/targets/javascript/fetch/client.js +115 -0
- package/dist/src/targets/javascript/fetch/fixtures/application-form-encoded.js +9 -0
- package/dist/src/targets/javascript/fetch/fixtures/application-json.js +16 -0
- package/dist/src/targets/javascript/fetch/fixtures/cookies.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/custom-method.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/full.js +13 -0
- package/dist/src/targets/javascript/fetch/fixtures/headers.js +8 -0
- package/dist/src/targets/javascript/fetch/fixtures/http-insecure.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/jsonObj-multiline.js +9 -0
- package/dist/src/targets/javascript/fetch/fixtures/jsonObj-null-value.js +9 -0
- package/dist/src/targets/javascript/fetch/fixtures/multipart-data.js +9 -0
- package/dist/src/targets/javascript/fetch/fixtures/multipart-file.js +8 -0
- package/dist/src/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/multipart-form-data.js +8 -0
- package/dist/src/targets/javascript/fetch/fixtures/nested.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/query-encoded.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/query.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/short.js +5 -0
- package/dist/src/targets/javascript/fetch/fixtures/text-plain.js +5 -0
- package/dist/src/targets/javascript/jquery/client.js +93 -0
- package/dist/src/targets/javascript/jquery/fixtures/application-form-encoded.js +17 -0
- package/dist/src/targets/javascript/jquery/fixtures/application-json.js +15 -0
- package/dist/src/targets/javascript/jquery/fixtures/cookies.js +13 -0
- package/dist/src/targets/javascript/jquery/fixtures/custom-method.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/full.js +18 -0
- package/dist/src/targets/javascript/jquery/fixtures/headers.js +15 -0
- package/dist/src/targets/javascript/jquery/fixtures/http-insecure.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/jsonObj-multiline.js +15 -0
- package/dist/src/targets/javascript/jquery/fixtures/jsonObj-null-value.js +15 -0
- package/dist/src/targets/javascript/jquery/fixtures/multipart-data.js +18 -0
- package/dist/src/targets/javascript/jquery/fixtures/multipart-file.js +17 -0
- package/dist/src/targets/javascript/jquery/fixtures/multipart-form-data-no-params.js +13 -0
- package/dist/src/targets/javascript/jquery/fixtures/multipart-form-data.js +17 -0
- package/dist/src/targets/javascript/jquery/fixtures/nested.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/query-encoded.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/query.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/short.js +11 -0
- package/dist/src/targets/javascript/jquery/fixtures/text-plain.js +14 -0
- package/dist/src/targets/javascript/target.js +21 -0
- package/dist/src/targets/javascript/xhr/client.js +90 -0
- package/dist/src/targets/javascript/xhr/fixtures/application-form-encoded.js +12 -0
- package/dist/src/targets/javascript/xhr/fixtures/application-json.js +31 -0
- package/dist/src/targets/javascript/xhr/fixtures/cookies.js +12 -0
- package/dist/src/targets/javascript/xhr/fixtures/cors.js +10 -0
- package/dist/src/targets/javascript/xhr/fixtures/custom-method.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/full.js +14 -0
- package/dist/src/targets/javascript/xhr/fixtures/headers.js +14 -0
- package/dist/src/targets/javascript/xhr/fixtures/http-insecure.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/jsonObj-multiline.js +14 -0
- package/dist/src/targets/javascript/xhr/fixtures/jsonObj-null-value.js +14 -0
- package/dist/src/targets/javascript/xhr/fixtures/multipart-data.js +13 -0
- package/dist/src/targets/javascript/xhr/fixtures/multipart-file.js +12 -0
- package/dist/src/targets/javascript/xhr/fixtures/multipart-form-data-no-params.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/multipart-form-data.js +12 -0
- package/dist/src/targets/javascript/xhr/fixtures/nested.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/query-encoded.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/query.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/short.js +11 -0
- package/dist/src/targets/javascript/xhr/fixtures/text-plain.js +12 -0
- package/dist/src/targets/kotlin/okhttp/client.js +79 -0
- package/dist/src/targets/kotlin/target.js +15 -0
- package/dist/src/targets/node/axios/client.js +87 -0
- package/dist/src/targets/node/axios/fixtures/application-form-encoded.js +19 -0
- package/dist/src/targets/node/axios/fixtures/application-json.js +22 -0
- package/dist/src/targets/node/axios/fixtures/cookies.js +14 -0
- package/dist/src/targets/node/axios/fixtures/custom-method.js +10 -0
- package/dist/src/targets/node/axios/fixtures/full.js +22 -0
- package/dist/src/targets/node/axios/fixtures/headers.js +14 -0
- package/dist/src/targets/node/axios/fixtures/http-insecure.js +10 -0
- package/dist/src/targets/node/axios/fixtures/jsonObj-multiline.js +15 -0
- package/dist/src/targets/node/axios/fixtures/jsonObj-null-value.js +15 -0
- package/dist/src/targets/node/axios/fixtures/multipart-data.js +15 -0
- package/dist/src/targets/node/axios/fixtures/multipart-file.js +15 -0
- package/dist/src/targets/node/axios/fixtures/multipart-form-data-no-params.js +14 -0
- package/dist/src/targets/node/axios/fixtures/multipart-form-data.js +15 -0
- package/dist/src/targets/node/axios/fixtures/nested.js +13 -0
- package/dist/src/targets/node/axios/fixtures/query-encoded.js +13 -0
- package/dist/src/targets/node/axios/fixtures/query.js +13 -0
- package/dist/src/targets/node/axios/fixtures/short.js +10 -0
- package/dist/src/targets/node/axios/fixtures/text-plain.js +15 -0
- package/dist/src/targets/node/fetch/client.js +149 -0
- package/dist/src/targets/node/fetch/fixtures/application-form-encoded.js +15 -0
- package/dist/src/targets/node/fetch/fixtures/application-json.js +18 -0
- package/dist/src/targets/node/fetch/fixtures/cookies.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/custom-method.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/full.js +18 -0
- package/dist/src/targets/node/fetch/fixtures/headers.js +10 -0
- package/dist/src/targets/node/fetch/fixtures/http-insecure.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/jsonObj-multiline.js +11 -0
- package/dist/src/targets/node/fetch/fixtures/jsonObj-null-value.js +11 -0
- package/dist/src/targets/node/fetch/fixtures/multipart-data.js +13 -0
- package/dist/src/targets/node/fetch/fixtures/multipart-file.js +12 -0
- package/dist/src/targets/node/fetch/fixtures/multipart-form-data-no-params.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/multipart-form-data.js +11 -0
- package/dist/src/targets/node/fetch/fixtures/nested.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/query-encoded.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/query.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/short.js +7 -0
- package/dist/src/targets/node/fetch/fixtures/text-plain.js +7 -0
- package/dist/src/targets/node/native/client.js +91 -0
- package/dist/src/targets/node/native/fixtures/application-form-encoded.js +24 -0
- package/dist/src/targets/node/native/fixtures/application-json.js +30 -0
- package/dist/src/targets/node/native/fixtures/cookies.js +22 -0
- package/dist/src/targets/node/native/fixtures/custom-method.js +20 -0
- package/dist/src/targets/node/native/fixtures/full.js +26 -0
- package/dist/src/targets/node/native/fixtures/headers.js +24 -0
- package/dist/src/targets/node/native/fixtures/http-insecure.js +20 -0
- package/dist/src/targets/node/native/fixtures/jsonObj-multiline.js +23 -0
- package/dist/src/targets/node/native/fixtures/jsonObj-null-value.js +23 -0
- package/dist/src/targets/node/native/fixtures/multipart-data.js +23 -0
- package/dist/src/targets/node/native/fixtures/multipart-file.js +23 -0
- package/dist/src/targets/node/native/fixtures/multipart-form-data-no-params.js +22 -0
- package/dist/src/targets/node/native/fixtures/multipart-form-data.js +23 -0
- package/dist/src/targets/node/native/fixtures/nested.js +20 -0
- package/dist/src/targets/node/native/fixtures/query-encoded.js +20 -0
- package/dist/src/targets/node/native/fixtures/query.js +20 -0
- package/dist/src/targets/node/native/fixtures/short.js +20 -0
- package/dist/src/targets/node/native/fixtures/text-plain.js +23 -0
- package/dist/src/targets/node/request/client.js +116 -0
- package/dist/src/targets/node/request/fixtures/application-form-encoded.js +13 -0
- package/dist/src/targets/node/request/fixtures/application-json.js +21 -0
- package/dist/src/targets/node/request/fixtures/cookies.js +11 -0
- package/dist/src/targets/node/request/fixtures/custom-method.js +8 -0
- package/dist/src/targets/node/request/fixtures/full.js +20 -0
- package/dist/src/targets/node/request/fixtures/headers.js +12 -0
- package/dist/src/targets/node/request/fixtures/http-insecure.js +8 -0
- package/dist/src/targets/node/request/fixtures/jsonObj-multiline.js +14 -0
- package/dist/src/targets/node/request/fixtures/jsonObj-null-value.js +14 -0
- package/dist/src/targets/node/request/fixtures/multipart-data.js +20 -0
- package/dist/src/targets/node/request/fixtures/multipart-file.js +19 -0
- package/dist/src/targets/node/request/fixtures/multipart-form-data-no-params.js +12 -0
- package/dist/src/targets/node/request/fixtures/multipart-form-data.js +13 -0
- package/dist/src/targets/node/request/fixtures/nested.js +11 -0
- package/dist/src/targets/node/request/fixtures/query-encoded.js +11 -0
- package/dist/src/targets/node/request/fixtures/query.js +11 -0
- package/dist/src/targets/node/request/fixtures/short.js +8 -0
- package/dist/src/targets/node/request/fixtures/text-plain.js +13 -0
- package/dist/src/targets/node/target.js +24 -0
- package/dist/src/targets/node/unirest/client.js +119 -0
- package/dist/src/targets/node/unirest/fixtures/application-form-encoded.js +15 -0
- package/dist/src/targets/node/unirest/fixtures/application-json.js +32 -0
- package/dist/src/targets/node/unirest/fixtures/cookies.js +12 -0
- package/dist/src/targets/node/unirest/fixtures/custom-method.js +8 -0
- package/dist/src/targets/node/unirest/fixtures/full.js +27 -0
- package/dist/src/targets/node/unirest/fixtures/headers.js +13 -0
- package/dist/src/targets/node/unirest/fixtures/http-insecure.js +8 -0
- package/dist/src/targets/node/unirest/fixtures/jsonObj-multiline.js +15 -0
- package/dist/src/targets/node/unirest/fixtures/jsonObj-null-value.js +15 -0
- package/dist/src/targets/node/unirest/fixtures/multipart-data.js +20 -0
- package/dist/src/targets/node/unirest/fixtures/multipart-file.js +18 -0
- package/dist/src/targets/node/unirest/fixtures/multipart-form-data-no-params.js +11 -0
- package/dist/src/targets/node/unirest/fixtures/multipart-form-data.js +16 -0
- package/dist/src/targets/node/unirest/fixtures/nested.js +13 -0
- package/dist/src/targets/node/unirest/fixtures/query-encoded.js +12 -0
- package/dist/src/targets/node/unirest/fixtures/query.js +16 -0
- package/dist/src/targets/node/unirest/fixtures/short.js +8 -0
- package/dist/src/targets/node/unirest/fixtures/text-plain.js +12 -0
- package/dist/src/targets/objc/helpers.js +59 -0
- package/dist/src/targets/objc/nsurlsession/client.js +151 -0
- package/dist/src/targets/objc/target.js +15 -0
- package/dist/src/targets/ocaml/cohttp/client.js +72 -0
- package/dist/src/targets/ocaml/target.js +15 -0
- package/dist/src/targets/php/curl/client.js +135 -0
- package/dist/src/targets/php/guzzle/client.js +126 -0
- package/dist/src/targets/php/helpers.js +63 -0
- package/dist/src/targets/php/http1/client.js +90 -0
- package/dist/src/targets/php/http2/client.js +128 -0
- package/dist/src/targets/php/target.js +22 -0
- package/dist/src/targets/powershell/common.js +49 -0
- package/dist/src/targets/powershell/restmethod/client.js +13 -0
- package/dist/src/targets/powershell/target.js +17 -0
- package/dist/src/targets/powershell/webrequest/client.js +13 -0
- package/dist/src/targets/python/helpers.js +70 -0
- package/dist/src/targets/python/requests/client.js +161 -0
- package/dist/src/targets/python/target.js +16 -0
- package/dist/src/targets/r/httr/client.js +125 -0
- package/dist/src/targets/r/target.js +15 -0
- package/dist/src/targets/ruby/native/client.js +69 -0
- package/dist/src/targets/ruby/target.js +15 -0
- package/dist/src/targets/shell/curl/client.js +171 -0
- package/dist/src/targets/shell/httpie/client.js +111 -0
- package/dist/src/targets/shell/target.js +20 -0
- package/dist/src/targets/shell/wget/client.js +55 -0
- package/dist/src/targets/swift/helpers.js +80 -0
- package/dist/src/targets/swift/nsurlsession/client.js +156 -0
- package/dist/src/targets/swift/target.js +15 -0
- package/dist/src/targets/targets.js +130 -0
- package/package.json +26 -21
- package/src/helpers/code-builder.js +0 -108
- package/src/helpers/form-data.js +0 -107
- package/src/helpers/headers.js +0 -48
- package/src/helpers/reducer.js +0 -20
- package/src/index.js +0 -361
- package/src/targets/c/index.js +0 -10
- package/src/targets/c/libcurl.js +0 -45
- package/src/targets/clojure/clj_http.js +0 -176
- package/src/targets/clojure/index.js +0 -10
- package/src/targets/csharp/httpclient.js +0 -157
- package/src/targets/csharp/index.js +0 -11
- package/src/targets/csharp/restsharp.js +0 -49
- package/src/targets/go/index.js +0 -10
- package/src/targets/go/native.js +0 -130
- package/src/targets/http/http1.1.js +0 -89
- package/src/targets/http/index.js +0 -10
- package/src/targets/index.js +0 -20
- package/src/targets/java/asynchttp.js +0 -54
- package/src/targets/java/index.js +0 -13
- package/src/targets/java/nethttp.js +0 -59
- package/src/targets/java/okhttp.js +0 -78
- package/src/targets/java/unirest.js +0 -57
- package/src/targets/javascript/axios.js +0 -101
- package/src/targets/javascript/fetch.js +0 -129
- package/src/targets/javascript/index.js +0 -13
- package/src/targets/javascript/jquery.js +0 -89
- package/src/targets/javascript/xhr.js +0 -86
- package/src/targets/kotlin/index.js +0 -10
- package/src/targets/kotlin/okhttp.js +0 -78
- package/src/targets/node/axios.js +0 -76
- package/src/targets/node/fetch.js +0 -145
- package/src/targets/node/index.js +0 -15
- package/src/targets/node/native.js +0 -92
- package/src/targets/node/request.js +0 -126
- package/src/targets/node/unirest.js +0 -120
- package/src/targets/objc/helpers.js +0 -80
- package/src/targets/objc/index.js +0 -10
- package/src/targets/objc/nsurlsession.js +0 -164
- package/src/targets/ocaml/cohttp.js +0 -73
- package/src/targets/ocaml/index.js +0 -10
- package/src/targets/php/curl.js +0 -142
- package/src/targets/php/guzzle.js +0 -135
- package/src/targets/php/helpers.js +0 -87
- package/src/targets/php/http1.js +0 -85
- package/src/targets/php/http2.js +0 -131
- package/src/targets/php/index.js +0 -14
- package/src/targets/powershell/common.js +0 -60
- package/src/targets/powershell/index.js +0 -11
- package/src/targets/powershell/restmethod.js +0 -8
- package/src/targets/powershell/webrequest.js +0 -8
- package/src/targets/python/helpers.js +0 -85
- package/src/targets/python/index.js +0 -11
- package/src/targets/python/requests.js +0 -163
- package/src/targets/r/httr.js +0 -134
- package/src/targets/r/index.js +0 -10
- package/src/targets/ruby/index.js +0 -10
- package/src/targets/ruby/native.js +0 -71
- package/src/targets/shell/curl.js +0 -157
- package/src/targets/shell/helpers.js +0 -23
- package/src/targets/shell/httpie.js +0 -129
- package/src/targets/shell/index.js +0 -13
- package/src/targets/shell/wget.js +0 -52
- package/src/targets/swift/helpers.js +0 -93
- package/src/targets/swift/index.js +0 -10
- package/src/targets/swift/nsurlsession.js +0 -152
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# HTTP Snippet [![version][npm-version]][npm-url] [![License][npm-license]][license-url]
|
|
2
2
|
|
|
3
|
-
> HTTP Request snippet generator for
|
|
3
|
+
> HTTP Request snippet generator for _many_ languages & tools including: `cURL`, `HTTPie`, `Javascript`, `Node`, `C`, `Java`, `PHP`, `Objective-C`, `Swift`, `Python`, `Ruby`, `C#`, `Go`, `OCaml` and [more](https://github.com/Kong/httpsnippet/wiki/Targets)!
|
|
4
4
|
|
|
5
5
|
Relies on the popular [HAR](http://www.softwareishard.com/blog/har-12-spec/#request) format to import data and describe HTTP calls.
|
|
6
6
|
|
|
7
|
-
See it in action on
|
|
7
|
+
See it in action on [ReadMe](https://docs.readme.com/reference/getopenroles).
|
|
8
8
|
|
|
9
9
|
[](https://github.com/readmeio/httpsnippet)
|
|
10
10
|
|
|
@@ -20,17 +20,16 @@ npm install --save @readme/httpsnippet
|
|
|
20
20
|
|
|
21
21
|
#### source
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
Type: `object`
|
|
23
|
+
_Required_ Type: `object`
|
|
25
24
|
|
|
26
|
-
Name of [conversion target](https://github.com/
|
|
25
|
+
Name of [conversion target](https://github.com/Kong/httpsnippet/wiki/Targets)
|
|
27
26
|
|
|
28
|
-
```
|
|
29
|
-
|
|
27
|
+
```ts
|
|
28
|
+
import { HTTPSnippet } from 'httpsnippet';
|
|
30
29
|
|
|
31
30
|
const snippet = new HTTPSnippet({
|
|
32
31
|
method: 'GET',
|
|
33
|
-
url: 'https://httpbin.
|
|
32
|
+
url: 'https://httpbin.org/anything',
|
|
34
33
|
});
|
|
35
34
|
```
|
|
36
35
|
|
|
@@ -46,130 +45,132 @@ Available options:
|
|
|
46
45
|
|
|
47
46
|
#### target
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
Type: `string`
|
|
48
|
+
_Required_ Type: `string`
|
|
51
49
|
|
|
52
|
-
Name of [conversion target](https://github.com/
|
|
50
|
+
Name of [conversion target](https://github.com/Kong/httpsnippet/wiki/Targets)
|
|
53
51
|
|
|
54
52
|
#### options
|
|
55
53
|
|
|
56
54
|
Type: `object`
|
|
57
55
|
|
|
58
|
-
Target options,
|
|
56
|
+
Target options, _see [wiki](https://github.com/Kong/httpsnippet/wiki/Targets) for details_
|
|
59
57
|
|
|
60
|
-
```
|
|
61
|
-
|
|
58
|
+
```ts
|
|
59
|
+
import { HTTPSnippet } from 'httpsnippet';
|
|
62
60
|
|
|
63
61
|
const snippet = new HTTPSnippet({
|
|
64
62
|
method: 'GET',
|
|
65
|
-
url: '
|
|
63
|
+
url: 'httsp://httpbin.org/anything',
|
|
66
64
|
});
|
|
67
65
|
|
|
68
66
|
// generate Node.js: Native output
|
|
69
67
|
console.log(snippet.convert('node'));
|
|
70
68
|
|
|
71
69
|
// generate Node.js: Native output, indent with tabs
|
|
72
|
-
console.log(
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
console.log(
|
|
71
|
+
snippet.convert('node', {
|
|
72
|
+
indent: '\t',
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### convert(target [, client, options])
|
|
78
78
|
|
|
79
|
-
####
|
|
79
|
+
#### Target
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
Type: `string`
|
|
81
|
+
_Required_ Type: `string`
|
|
83
82
|
|
|
84
|
-
Name of [conversion target](https://github.com/
|
|
83
|
+
Name of [conversion target](https://github.com/Kong/httpsnippet/wiki/Targets)
|
|
85
84
|
|
|
86
|
-
####
|
|
85
|
+
#### Client
|
|
87
86
|
|
|
88
87
|
Type: `string`
|
|
89
88
|
|
|
90
|
-
Name of conversion target [client library](https://github.com/
|
|
89
|
+
Name of conversion target [client library](https://github.com/Kong/httpsnippet/wiki/Targets)
|
|
91
90
|
|
|
92
|
-
####
|
|
91
|
+
#### Options
|
|
93
92
|
|
|
94
93
|
Type: `object`
|
|
95
94
|
|
|
96
|
-
Target options,
|
|
95
|
+
Target options, _see [wiki](https://github.com/Kong/httpsnippet/wiki/Targets) for details_
|
|
97
96
|
|
|
98
|
-
```
|
|
99
|
-
|
|
97
|
+
```ts
|
|
98
|
+
import { HTTPSnippet } from 'httpsnippet';
|
|
100
99
|
|
|
101
100
|
const snippet = new HTTPSnippet({
|
|
102
101
|
method: 'GET',
|
|
103
|
-
url: 'https://httpbin.
|
|
102
|
+
url: 'https://httpbin.org/anything',
|
|
104
103
|
});
|
|
105
104
|
|
|
106
105
|
// generate Shell: cURL output
|
|
107
|
-
console.log(
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
console.log(
|
|
107
|
+
snippet.convert('shell', 'curl', {
|
|
108
|
+
indent: '\t',
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
110
111
|
|
|
111
112
|
// generate Node.js: Unirest output
|
|
112
113
|
console.log(snippet.convert('node', 'unirest'));
|
|
113
114
|
```
|
|
114
115
|
|
|
115
116
|
### addTarget(target)
|
|
117
|
+
|
|
116
118
|
#### target
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
Type: `object`
|
|
120
|
+
_Required_ Type: `object`
|
|
120
121
|
|
|
121
122
|
Representation of a [conversion target](https://github.com/Kong/httpsnippet/wiki/Creating-Targets). Can use this to use targets that are not officially supported.
|
|
122
123
|
|
|
123
|
-
```
|
|
124
|
-
|
|
124
|
+
```ts
|
|
125
|
+
import { customLanguageTarget } from 'httpsnippet-for-my-lang';
|
|
125
126
|
HTTPSnippet.addTarget(customLanguageTarget);
|
|
126
127
|
```
|
|
127
128
|
|
|
128
129
|
### addTargetClient(target, client)
|
|
129
|
-
### target
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
Type: `string`
|
|
131
|
+
### Target
|
|
133
132
|
|
|
134
|
-
|
|
133
|
+
_Required_ Type: `string`
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
Name of [conversion target](https://github.com/Kong/httpsnippet/wiki/Targets)
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
### Client
|
|
138
|
+
|
|
139
|
+
_Required_ Type: `object`
|
|
140
140
|
|
|
141
141
|
Representation of a [conversion target client](https://github.com/Kong/httpsnippet/wiki/Creating-Targets). Can use this to use target clients that are not officially supported.
|
|
142
142
|
|
|
143
|
-
```
|
|
144
|
-
|
|
143
|
+
```ts
|
|
144
|
+
import { customClient } from 'httpsnippet-for-my-node-http-client';
|
|
145
145
|
HTTPSnippet.addTargetClient('node', customClient);
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
## Documentation
|
|
149
149
|
|
|
150
|
-
At the heart of this module is the [HAR Format](http://www.softwareishard.com/blog/har-12-spec/#request) as the HTTP request description format, please review some of the sample JSON HAR Request objects in [test fixtures](/
|
|
150
|
+
At the heart of this module is the [HAR Format](http://www.softwareishard.com/blog/har-12-spec/#request) as the HTTP request description format, please review some of the sample JSON HAR Request objects in [test fixtures](/test/fixtures/requests), or read the [HAR Docs](http://www.softwareishard.com/blog/har-12-spec/#request) for more details.
|
|
151
151
|
|
|
152
|
-
For detailed information on each target, please review the [wiki](https://github.com/
|
|
152
|
+
For detailed information on each target, please review the [wiki](https://github.com/Kong/httpsnippet/wiki).
|
|
153
153
|
|
|
154
154
|
## Differences from `kong/httpsnippet`
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
There are some major differences between this library and the [httpsnippet](https://github.com/Kong/httpsnippet) upstream:
|
|
157
157
|
|
|
158
|
+
* Includes a full integration test suite for a handful of clients and targets.
|
|
158
159
|
* Does not ship with a CLI component.
|
|
159
|
-
* The `
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
160
|
+
* The main `HTTPSnippet` export contains an `options` argument for an `harIsAlreadyEncoded` option for disabling [escaping](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) of cookies and query strings in URLs.
|
|
161
|
+
* We added this because all HARs that we interact with already have this data escaped and this option prevents them from being double encoded, thus corrupting the data.
|
|
162
|
+
* Node
|
|
163
|
+
* `fetch`
|
|
164
|
+
* Body payloads are treated as an object literal and wrapped within `JSON.stringify()`. We do this to keep those targets looking nicer with those kinds of payloads. This also applies to the JS `fetch` target as wel.
|
|
165
|
+
* `request`
|
|
166
|
+
* Does not provide query string parameters in a `params` argument due to complexities with query encoding.
|
|
167
|
+
* PHP → `guzzle`
|
|
168
|
+
* Snippets have `require_once('vendor/autoload.php');` prefixed at the top.
|
|
169
|
+
* Python
|
|
170
|
+
* `python3`
|
|
171
|
+
* Does not ship this client due to its incompatibility with being able to support file uploads.
|
|
172
|
+
* `requests`
|
|
173
|
+
* Does not provide query string parameters in a `params` argument due to complexities with query encoding.
|
|
173
174
|
|
|
174
175
|
## License
|
|
175
176
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "4.0.2",
|
|
3
|
+
"name": "@readme/httpsnippet",
|
|
4
|
+
"description": "HTTP Request snippet generator for *most* languages",
|
|
5
|
+
"homepage": "https://github.com/readmeio/httpsnippet",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"api",
|
|
11
|
+
"clojure",
|
|
12
|
+
"csharp",
|
|
13
|
+
"curl",
|
|
14
|
+
"go",
|
|
15
|
+
"har",
|
|
16
|
+
"http",
|
|
17
|
+
"httpie",
|
|
18
|
+
"httr",
|
|
19
|
+
"java",
|
|
20
|
+
"javascript",
|
|
21
|
+
"jquery",
|
|
22
|
+
"kotlin",
|
|
23
|
+
"objc",
|
|
24
|
+
"objective-c",
|
|
25
|
+
"ocaml",
|
|
26
|
+
"php",
|
|
27
|
+
"python",
|
|
28
|
+
"request",
|
|
29
|
+
"requests",
|
|
30
|
+
"ruby",
|
|
31
|
+
"shell",
|
|
32
|
+
"snippet",
|
|
33
|
+
"swift",
|
|
34
|
+
"swift",
|
|
35
|
+
"unirest",
|
|
36
|
+
"xhr",
|
|
37
|
+
"xmlhttprequest"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=14"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/readmeio/httpsnippet.git"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc --build tsconfig.build.json",
|
|
51
|
+
"clean": "tsc --build tsconfig.build.json --clean",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"prebuild": "npm run clean",
|
|
54
|
+
"prepack": "npm run build",
|
|
55
|
+
"pretest": "npm run lint",
|
|
56
|
+
"prettier": "prettier --list-different --write \"./**/**.js\"",
|
|
57
|
+
"test": "jest --coverage"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@readme/eslint-config": "^8.8.3",
|
|
61
|
+
"@types/eslint": "^8.4.1",
|
|
62
|
+
"@types/event-stream": "^4.0.0",
|
|
63
|
+
"@types/har-format": "^1.2.8",
|
|
64
|
+
"@types/jest": "^27.4.1",
|
|
65
|
+
"@types/node": "^16.11.26",
|
|
66
|
+
"@types/qs": "^6.9.7",
|
|
67
|
+
"@types/stringify-object": "^4.0.1",
|
|
68
|
+
"eslint": "^8.19.0",
|
|
69
|
+
"glob": "^8.0.1",
|
|
70
|
+
"jest": "^28.0.3",
|
|
71
|
+
"prettier": "^2.7.1",
|
|
72
|
+
"require-directory": "^2.1.1",
|
|
73
|
+
"ts-jest": "^28.0.5",
|
|
74
|
+
"type-fest": "^2.12.2",
|
|
75
|
+
"typescript": "^4.6.3"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"ajv": "^6.12.6",
|
|
79
|
+
"event-stream": "4.0.1",
|
|
80
|
+
"form-data": "^4.0.0",
|
|
81
|
+
"har-schema": "^2.0.0",
|
|
82
|
+
"qs": "^6.10.1",
|
|
83
|
+
"stringify-object": "^3.3.0"
|
|
84
|
+
},
|
|
85
|
+
"prettier": "@readme/eslint-config/prettier"
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.customTarget = void 0;
|
|
4
|
+
var client_1 = require("../targets/node/request/client");
|
|
5
|
+
exports.customTarget = {
|
|
6
|
+
info: {
|
|
7
|
+
key: 'js-variant',
|
|
8
|
+
title: 'JavaScript Variant',
|
|
9
|
+
extname: '.js',
|
|
10
|
+
"default": 'request'
|
|
11
|
+
},
|
|
12
|
+
clientsById: {
|
|
13
|
+
request: client_1.request
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.mimetypes = void 0;
|
|
4
|
+
exports.mimetypes = {
|
|
5
|
+
'multipart/mixed': {
|
|
6
|
+
method: 'POST',
|
|
7
|
+
url: 'https://httpbin.org/anything',
|
|
8
|
+
postData: {
|
|
9
|
+
mimeType: 'multipart/mixed',
|
|
10
|
+
text: ''
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
'multipart/related': {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
url: 'https://httpbin.org/anything',
|
|
16
|
+
postData: {
|
|
17
|
+
mimeType: 'multipart/related',
|
|
18
|
+
text: ''
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
'multipart/form-data': {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: 'https://httpbin.org/anything',
|
|
24
|
+
postData: {
|
|
25
|
+
mimeType: 'multipart/form-data',
|
|
26
|
+
text: ''
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
'multipart/alternative': {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
url: 'https://httpbin.org/anything',
|
|
32
|
+
postData: {
|
|
33
|
+
mimeType: 'multipart/alternative',
|
|
34
|
+
text: ''
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
'application/x-www-form-urlencoded': {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
url: 'https://httpbin.org/anything',
|
|
40
|
+
postData: {
|
|
41
|
+
mimeType: 'application/x-www-form-urlencoded',
|
|
42
|
+
text: ''
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
'text/json': {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
url: 'https://httpbin.org/anything',
|
|
48
|
+
postData: {
|
|
49
|
+
mimeType: 'text/json',
|
|
50
|
+
text: ''
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
'text/x-json': {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
url: 'https://httpbin.org/anything',
|
|
56
|
+
postData: {
|
|
57
|
+
mimeType: 'text/x-json',
|
|
58
|
+
text: ''
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
'application/x-json': {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
url: 'https://httpbin.org/anything',
|
|
64
|
+
postData: {
|
|
65
|
+
mimeType: 'application/x-json',
|
|
66
|
+
text: ''
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
'invalid-json': {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
url: 'https://httpbin.org/anything',
|
|
72
|
+
postData: {
|
|
73
|
+
mimeType: 'application/json',
|
|
74
|
+
text: 'foo/bar'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = {
|
|
3
|
+
log: {
|
|
4
|
+
version: '1.2',
|
|
5
|
+
creator: {
|
|
6
|
+
name: 'HTTPSnippet',
|
|
7
|
+
version: '1.0.0'
|
|
8
|
+
},
|
|
9
|
+
entries: [
|
|
10
|
+
{
|
|
11
|
+
request: {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: 'https://httpbin.org/anything',
|
|
14
|
+
headers: [
|
|
15
|
+
{
|
|
16
|
+
name: 'content-type',
|
|
17
|
+
value: 'application/x-www-form-urlencoded'
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
postData: {
|
|
21
|
+
mimeType: 'application/x-www-form-urlencoded',
|
|
22
|
+
params: [
|
|
23
|
+
{
|
|
24
|
+
name: 'foo',
|
|
25
|
+
value: 'bar'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'hello',
|
|
29
|
+
value: 'world'
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
response: {
|
|
35
|
+
status: 200,
|
|
36
|
+
statusText: 'OK',
|
|
37
|
+
httpVersion: 'HTTP/1.1',
|
|
38
|
+
headers: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Content-Type',
|
|
41
|
+
value: 'application/json'
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
content: {
|
|
45
|
+
size: -1,
|
|
46
|
+
mimeType: 'application/json',
|
|
47
|
+
text: JSON.stringify({
|
|
48
|
+
args: {},
|
|
49
|
+
data: '',
|
|
50
|
+
files: {},
|
|
51
|
+
form: {
|
|
52
|
+
foo: 'bar',
|
|
53
|
+
hello: 'world'
|
|
54
|
+
},
|
|
55
|
+
headers: {
|
|
56
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
57
|
+
},
|
|
58
|
+
json: null,
|
|
59
|
+
method: 'POST',
|
|
60
|
+
url: 'https://httpbin.org/anything'
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
headersSize: -1,
|
|
64
|
+
bodySize: -1
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = {
|
|
3
|
+
log: {
|
|
4
|
+
version: '1.2',
|
|
5
|
+
creator: {
|
|
6
|
+
name: 'HTTPSnippet',
|
|
7
|
+
version: '1.0.0'
|
|
8
|
+
},
|
|
9
|
+
entries: [
|
|
10
|
+
{
|
|
11
|
+
request: {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: 'https://httpbin.org/anything',
|
|
14
|
+
headers: [
|
|
15
|
+
{
|
|
16
|
+
name: 'content-type',
|
|
17
|
+
value: 'application/json'
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
postData: {
|
|
21
|
+
mimeType: 'application/json',
|
|
22
|
+
text: '{"number":1,"string":"f\\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
response: {
|
|
26
|
+
status: 200,
|
|
27
|
+
statusText: 'OK',
|
|
28
|
+
httpVersion: 'HTTP/1.1',
|
|
29
|
+
headers: [
|
|
30
|
+
{
|
|
31
|
+
name: 'Content-Type',
|
|
32
|
+
value: 'application/json'
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
content: {
|
|
36
|
+
size: -1,
|
|
37
|
+
mimeType: 'application/json',
|
|
38
|
+
text: JSON.stringify({
|
|
39
|
+
args: {},
|
|
40
|
+
data: '{\n "number": 1,\n "string": "f\\"oo",\n "arr": [\n 1,\n 2,\n 3\n ],\n "nested": {\n "a": "b"\n },\n "arr_mix": [\n 1,\n "a",\n {\n "arr_mix_nested": {}\n }\n ],\n "boolean": false\n}',
|
|
41
|
+
files: {},
|
|
42
|
+
form: {},
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json'
|
|
45
|
+
},
|
|
46
|
+
json: {
|
|
47
|
+
arr: [1, 2, 3],
|
|
48
|
+
arr_mix: [
|
|
49
|
+
1,
|
|
50
|
+
'a',
|
|
51
|
+
{
|
|
52
|
+
arr_mix_nested: {}
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
boolean: false,
|
|
56
|
+
nested: {
|
|
57
|
+
a: 'b'
|
|
58
|
+
},
|
|
59
|
+
number: 1,
|
|
60
|
+
string: 'f"oo'
|
|
61
|
+
},
|
|
62
|
+
method: 'POST',
|
|
63
|
+
url: 'https://httpbin.org/anything'
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
headersSize: -1,
|
|
67
|
+
bodySize: -1
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = {
|
|
3
|
+
log: {
|
|
4
|
+
version: '1.2',
|
|
5
|
+
creator: {
|
|
6
|
+
name: 'HTTPSnippet',
|
|
7
|
+
version: '1.0.0'
|
|
8
|
+
},
|
|
9
|
+
entries: [
|
|
10
|
+
{
|
|
11
|
+
request: {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
url: 'https://httpbin.org/cookies',
|
|
14
|
+
cookies: [
|
|
15
|
+
{
|
|
16
|
+
name: 'foo',
|
|
17
|
+
value: 'bar'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'bar',
|
|
21
|
+
value: 'baz'
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
response: {
|
|
26
|
+
status: 200,
|
|
27
|
+
statusText: 'OK',
|
|
28
|
+
httpVersion: 'HTTP/1.1',
|
|
29
|
+
headers: [
|
|
30
|
+
{
|
|
31
|
+
name: 'Content-Type',
|
|
32
|
+
value: 'application/json'
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
content: {
|
|
36
|
+
size: -1,
|
|
37
|
+
mimeType: 'application/json',
|
|
38
|
+
text: JSON.stringify({
|
|
39
|
+
cookies: {
|
|
40
|
+
bar: 'baz',
|
|
41
|
+
foo: 'bar'
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
headersSize: -1,
|
|
46
|
+
bodySize: -1
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = {
|
|
3
|
+
log: {
|
|
4
|
+
version: '1.2',
|
|
5
|
+
creator: {
|
|
6
|
+
name: 'HTTPSnippet',
|
|
7
|
+
version: '1.0.0'
|
|
8
|
+
},
|
|
9
|
+
entries: [
|
|
10
|
+
{
|
|
11
|
+
request: {
|
|
12
|
+
method: 'PROPFIND',
|
|
13
|
+
url: 'https://httpbin.org/anything'
|
|
14
|
+
},
|
|
15
|
+
response: {
|
|
16
|
+
status: 405,
|
|
17
|
+
statusText: 'Method Not Allowed',
|
|
18
|
+
httpVersion: 'HTTP/1.1',
|
|
19
|
+
headers: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Content-Type',
|
|
22
|
+
value: 'text/html'
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
content: {
|
|
26
|
+
size: -1,
|
|
27
|
+
mimeType: 'text/html',
|
|
28
|
+
text: [
|
|
29
|
+
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',
|
|
30
|
+
'<title>405 Method Not Allowed</title>',
|
|
31
|
+
'<h1>Method Not Allowed</h1>',
|
|
32
|
+
'<p>The method is not allowed for the requested URL.</p>',
|
|
33
|
+
].join('\n')
|
|
34
|
+
},
|
|
35
|
+
headersSize: -1,
|
|
36
|
+
bodySize: -1
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
};
|