@readme/httpsnippet 7.1.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +24 -25
- package/dist/{chunk-DTZD7L6R.mjs → chunk-IAWYVBVW.js} +78 -61
- package/dist/chunk-IAWYVBVW.js.map +1 -0
- package/dist/{chunk-BCCGHMCJ.mjs → chunk-KT7MO6Z4.js} +1 -1
- package/dist/{chunk-UEOS42PC.mjs → chunk-Y7NI4MMY.js} +1 -1
- package/dist/helpers/code-builder.cjs +65 -0
- package/dist/helpers/code-builder.cjs.map +1 -0
- package/dist/helpers/code-builder.js +1 -63
- package/dist/helpers/code-builder.js.map +1 -1
- package/dist/helpers/reducer.cjs +20 -0
- package/dist/helpers/reducer.cjs.map +1 -0
- package/dist/helpers/reducer.js +1 -18
- package/dist/helpers/reducer.js.map +1 -1
- package/dist/{index-c415b193.d.ts → index-babe3117.d.ts} +10 -6
- package/dist/{index-ae5e535e.d.ts → index-c8003aae.d.ts} +11 -7
- package/dist/index.cjs +3745 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.mts → index.d.cts} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +179 -3767
- package/dist/index.js.map +1 -1
- package/dist/targets/index.cjs +3512 -0
- package/dist/targets/index.cjs.map +1 -0
- package/dist/targets/{index.d.mts → index.d.cts} +3 -3
- package/dist/targets/index.d.ts +1 -1
- package/dist/targets/index.js +2 -3493
- package/dist/targets/index.js.map +1 -1
- package/package.json +36 -41
- package/dist/chunk-DTZD7L6R.mjs.map +0 -1
- package/dist/helpers/code-builder.mjs +0 -3
- package/dist/helpers/code-builder.mjs.map +0 -1
- package/dist/helpers/reducer.mjs +0 -3
- package/dist/helpers/reducer.mjs.map +0 -1
- package/dist/index.mjs +0 -287
- package/dist/index.mjs.map +0 -1
- package/dist/targets/index.mjs +0 -4
- package/dist/targets/index.mjs.map +0 -1
- /package/dist/{chunk-BCCGHMCJ.mjs.map → chunk-KT7MO6Z4.js.map} +0 -0
- /package/dist/{chunk-UEOS42PC.mjs.map → chunk-Y7NI4MMY.js.map} +0 -0
- /package/dist/helpers/{code-builder.d.mts → code-builder.d.cts} +0 -0
- /package/dist/helpers/{reducer.d.mts → reducer.d.cts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023 ReadMe (https://readme.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Type: `object`
|
|
|
39
39
|
|
|
40
40
|
Available options:
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
- `harIsAlreadyEncoded` (`boolean`): In the event of you supplying a `source` HAR that already contains escaped data (query and cookie parameters)strings, this allows you to disable automatic encoding of those parameters to prevent them from being double-escaped.
|
|
43
43
|
|
|
44
44
|
### convert(target [, options])
|
|
45
45
|
|
|
@@ -64,11 +64,11 @@ const snippet = new HTTPSnippet({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// generate Node.js: Native output
|
|
67
|
-
console.log(snippet.convert('node'));
|
|
67
|
+
console.log(await snippet.convert('node'));
|
|
68
68
|
|
|
69
69
|
// generate Node.js: Native output, indent with tabs
|
|
70
70
|
console.log(
|
|
71
|
-
snippet.convert('node', {
|
|
71
|
+
await snippet.convert('node', {
|
|
72
72
|
indent: '\t',
|
|
73
73
|
}),
|
|
74
74
|
);
|
|
@@ -104,13 +104,13 @@ const snippet = new HTTPSnippet({
|
|
|
104
104
|
|
|
105
105
|
// generate Shell: cURL output
|
|
106
106
|
console.log(
|
|
107
|
-
snippet.convert('shell', 'curl', {
|
|
107
|
+
await snippet.convert('shell', 'curl', {
|
|
108
108
|
indent: '\t',
|
|
109
109
|
}),
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
// generate Node.js: Unirest output
|
|
113
|
-
console.log(snippet.convert('node', 'unirest'));
|
|
113
|
+
console.log(await snippet.convert('node', 'unirest'));
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
### addTarget(target)
|
|
@@ -155,32 +155,31 @@ For detailed information on each target, please review the [wiki](https://github
|
|
|
155
155
|
|
|
156
156
|
There are some major differences between this library and the [httpsnippet](https://github.com/Kong/httpsnippet) upstream:
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
- Includes a full integration test suite for a handful of clients and targets.
|
|
159
|
+
- Does not ship with a CLI component.
|
|
160
|
+
- Does not do any HAR schema validation. It's just assumed that the HAR you're supplying to the library is already valid.
|
|
161
|
+
- 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.
|
|
162
|
+
- 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.
|
|
163
|
+
- Does not support the `insecureSkipVerify` option on `go:native`, `node:native`, `ruby:native`, and `shell:curl` as we don't want snippets generated for our users to bypass SSL certificate verification.
|
|
164
|
+
- Node
|
|
165
|
+
- `fetch`
|
|
166
|
+
- 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 well.
|
|
167
|
+
- `request`
|
|
168
|
+
- Does not provide query string parameters in a `params` argument due to complexities with query encoding.
|
|
169
|
+
- PHP
|
|
170
|
+
- `guzzle`
|
|
171
|
+
- Snippets have `require_once('vendor/autoload.php');` prefixed at the top.
|
|
172
|
+
- Python
|
|
173
|
+
- `python3`
|
|
174
|
+
- Does not ship this client due to its incompatibility with being able to support file uploads.
|
|
175
|
+
- `requests`
|
|
176
|
+
- Does not provide query string parameters in a `params` argument due to complexities with query encoding.
|
|
177
177
|
|
|
178
178
|
## License
|
|
179
179
|
|
|
180
180
|
[MIT](LICENSE) © [Kong](https://konghq.com)
|
|
181
181
|
|
|
182
182
|
[license-url]: https://github.com/Kong/httpsnippet/blob/master/LICENSE
|
|
183
|
-
|
|
184
183
|
[npm-url]: https://www.npmjs.com/package/@readme/httpsnippet
|
|
185
184
|
[npm-license]: https://img.shields.io/npm/l/@readme/httpsnippet.svg?style=flat-square
|
|
186
185
|
[npm-version]: https://img.shields.io/npm/v/@readme/httpsnippet.svg?style=flat-square
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeBuilder } from './chunk-
|
|
1
|
+
import { CodeBuilder } from './chunk-Y7NI4MMY.js';
|
|
2
2
|
import stringifyObject9 from 'stringify-object';
|
|
3
3
|
|
|
4
4
|
// src/helpers/escape.ts
|
|
@@ -41,7 +41,8 @@ var libcurl = {
|
|
|
41
41
|
key: "libcurl",
|
|
42
42
|
title: "Libcurl",
|
|
43
43
|
link: "http://curl.haxx.se/libcurl",
|
|
44
|
-
description: "Simple REST and HTTP API Client for C"
|
|
44
|
+
description: "Simple REST and HTTP API Client for C",
|
|
45
|
+
extname: ".c"
|
|
45
46
|
},
|
|
46
47
|
convert: ({ method, fullUrl, headersObj, allHeaders, postData }) => {
|
|
47
48
|
const { push, blank, join } = new CodeBuilder();
|
|
@@ -78,7 +79,6 @@ var c = {
|
|
|
78
79
|
info: {
|
|
79
80
|
key: "c",
|
|
80
81
|
title: "C",
|
|
81
|
-
extname: ".c",
|
|
82
82
|
default: "libcurl",
|
|
83
83
|
cli: "c"
|
|
84
84
|
},
|
|
@@ -177,7 +177,8 @@ var clj_http = {
|
|
|
177
177
|
key: "clj_http",
|
|
178
178
|
title: "clj-http",
|
|
179
179
|
link: "https://github.com/dakrone/clj-http",
|
|
180
|
-
description: "An idiomatic clojure http client wrapping the apache client."
|
|
180
|
+
description: "An idiomatic clojure http client wrapping the apache client.",
|
|
181
|
+
extname: ".clj"
|
|
181
182
|
},
|
|
182
183
|
convert: ({ queryObj, method, postData, url, allHeaders }, options) => {
|
|
183
184
|
const { push, join } = new CodeBuilder({ indent: options?.indent });
|
|
@@ -270,7 +271,6 @@ var clojure = {
|
|
|
270
271
|
info: {
|
|
271
272
|
key: "clojure",
|
|
272
273
|
title: "Clojure",
|
|
273
|
-
extname: ".clj",
|
|
274
274
|
default: "clj_http"
|
|
275
275
|
},
|
|
276
276
|
clientsById: {
|
|
@@ -310,7 +310,8 @@ var httpclient = {
|
|
|
310
310
|
key: "httpclient",
|
|
311
311
|
title: "HttpClient",
|
|
312
312
|
link: "https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",
|
|
313
|
-
description: ".NET Standard HTTP Client"
|
|
313
|
+
description: ".NET Standard HTTP Client",
|
|
314
|
+
extname: ".cs"
|
|
314
315
|
},
|
|
315
316
|
convert: ({ allHeaders, postData, method, fullUrl }, options) => {
|
|
316
317
|
const opts = {
|
|
@@ -429,7 +430,8 @@ var restsharp = {
|
|
|
429
430
|
key: "restsharp",
|
|
430
431
|
title: "RestSharp",
|
|
431
432
|
link: "http://restsharp.org/",
|
|
432
|
-
description: "Simple REST and HTTP API Client for .NET"
|
|
433
|
+
description: "Simple REST and HTTP API Client for .NET",
|
|
434
|
+
extname: ".cs"
|
|
433
435
|
},
|
|
434
436
|
convert: ({ method, fullUrl, headersObj, cookies, postData, uriObj }) => {
|
|
435
437
|
const { push, join } = new CodeBuilder();
|
|
@@ -502,7 +504,6 @@ var csharp = {
|
|
|
502
504
|
info: {
|
|
503
505
|
key: "csharp",
|
|
504
506
|
title: "C#",
|
|
505
|
-
extname: ".cs",
|
|
506
507
|
default: "restsharp",
|
|
507
508
|
cli: "dotnet"
|
|
508
509
|
},
|
|
@@ -518,7 +519,8 @@ var native = {
|
|
|
518
519
|
key: "native",
|
|
519
520
|
title: "NewRequest",
|
|
520
521
|
link: "http://golang.org/pkg/net/http/#NewRequest",
|
|
521
|
-
description: "Golang HTTP client request"
|
|
522
|
+
description: "Golang HTTP client request",
|
|
523
|
+
extname: ".go"
|
|
522
524
|
},
|
|
523
525
|
convert: ({ postData, method, allHeaders, fullUrl }, options = {}) => {
|
|
524
526
|
const { blank, push, join } = new CodeBuilder({ indent: " " });
|
|
@@ -606,7 +608,6 @@ var go = {
|
|
|
606
608
|
info: {
|
|
607
609
|
key: "go",
|
|
608
610
|
title: "Go",
|
|
609
|
-
extname: ".go",
|
|
610
611
|
default: "native",
|
|
611
612
|
cli: "go"
|
|
612
613
|
},
|
|
@@ -622,7 +623,8 @@ var http11 = {
|
|
|
622
623
|
key: "http1.1",
|
|
623
624
|
title: "HTTP/1.1",
|
|
624
625
|
link: "https://tools.ietf.org/html/rfc7230",
|
|
625
|
-
description: "HTTP/1.1 request string in accordance with RFC 7230"
|
|
626
|
+
description: "HTTP/1.1 request string in accordance with RFC 7230",
|
|
627
|
+
extname: null
|
|
626
628
|
},
|
|
627
629
|
convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }, options) => {
|
|
628
630
|
const opts = {
|
|
@@ -658,8 +660,7 @@ var http = {
|
|
|
658
660
|
info: {
|
|
659
661
|
key: "http",
|
|
660
662
|
title: "HTTP",
|
|
661
|
-
|
|
662
|
-
default: "1.1"
|
|
663
|
+
default: "http1.1"
|
|
663
664
|
},
|
|
664
665
|
clientsById: {
|
|
665
666
|
"http1.1": http11
|
|
@@ -672,7 +673,8 @@ var asynchttp = {
|
|
|
672
673
|
key: "asynchttp",
|
|
673
674
|
title: "AsyncHttp",
|
|
674
675
|
link: "https://github.com/AsyncHttpClient/async-http-client",
|
|
675
|
-
description: "Asynchronous Http and WebSocket Client library for Java"
|
|
676
|
+
description: "Asynchronous Http and WebSocket Client library for Java",
|
|
677
|
+
extname: ".java"
|
|
676
678
|
},
|
|
677
679
|
convert: ({ method, allHeaders, postData, fullUrl }, options) => {
|
|
678
680
|
const opts = {
|
|
@@ -704,7 +706,8 @@ var nethttp = {
|
|
|
704
706
|
key: "nethttp",
|
|
705
707
|
title: "java.net.http",
|
|
706
708
|
link: "https://openjdk.java.net/groups/net/httpclient/intro.html",
|
|
707
|
-
description: "Java Standardized HTTP Client API"
|
|
709
|
+
description: "Java Standardized HTTP Client API",
|
|
710
|
+
extname: ".java"
|
|
708
711
|
},
|
|
709
712
|
convert: ({ allHeaders, fullUrl, method, postData }, options) => {
|
|
710
713
|
const opts = {
|
|
@@ -740,7 +743,8 @@ var okhttp = {
|
|
|
740
743
|
key: "okhttp",
|
|
741
744
|
title: "OkHttp",
|
|
742
745
|
link: "http://square.github.io/okhttp/",
|
|
743
|
-
description: "An HTTP Request Client Library"
|
|
746
|
+
description: "An HTTP Request Client Library",
|
|
747
|
+
extname: ".java"
|
|
744
748
|
},
|
|
745
749
|
convert: ({ postData, method, fullUrl, allHeaders }, options) => {
|
|
746
750
|
const opts = {
|
|
@@ -793,7 +797,8 @@ var unirest = {
|
|
|
793
797
|
key: "unirest",
|
|
794
798
|
title: "Unirest",
|
|
795
799
|
link: "http://unirest.io/java.html",
|
|
796
|
-
description: "Lightweight HTTP Request Client Library"
|
|
800
|
+
description: "Lightweight HTTP Request Client Library",
|
|
801
|
+
extname: ".java"
|
|
797
802
|
},
|
|
798
803
|
convert: ({ method, allHeaders, postData, fullUrl }, options) => {
|
|
799
804
|
const opts = {
|
|
@@ -823,7 +828,6 @@ var java = {
|
|
|
823
828
|
info: {
|
|
824
829
|
key: "java",
|
|
825
830
|
title: "Java",
|
|
826
|
-
extname: ".java",
|
|
827
831
|
default: "unirest"
|
|
828
832
|
},
|
|
829
833
|
clientsById: {
|
|
@@ -838,7 +842,8 @@ var axios = {
|
|
|
838
842
|
key: "axios",
|
|
839
843
|
title: "Axios",
|
|
840
844
|
link: "https://github.com/axios/axios",
|
|
841
|
-
description: "Promise based HTTP client for the browser and node.js"
|
|
845
|
+
description: "Promise based HTTP client for the browser and node.js",
|
|
846
|
+
extname: ".js"
|
|
842
847
|
},
|
|
843
848
|
convert: ({ allHeaders, method, url, queryObj, postData }, options) => {
|
|
844
849
|
const opts = {
|
|
@@ -913,7 +918,8 @@ var fetch = {
|
|
|
913
918
|
key: "fetch",
|
|
914
919
|
title: "fetch",
|
|
915
920
|
link: "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",
|
|
916
|
-
description: "Perform asynchronous HTTP requests with the Fetch API"
|
|
921
|
+
description: "Perform asynchronous HTTP requests with the Fetch API",
|
|
922
|
+
extname: ".js"
|
|
917
923
|
},
|
|
918
924
|
convert: ({ method, allHeaders, postData, fullUrl }, inputOpts) => {
|
|
919
925
|
const opts = {
|
|
@@ -998,7 +1004,8 @@ var jquery = {
|
|
|
998
1004
|
key: "jquery",
|
|
999
1005
|
title: "jQuery",
|
|
1000
1006
|
link: "http://api.jquery.com/jquery.ajax/",
|
|
1001
|
-
description: "Perform an asynchronous HTTP (Ajax) requests with jQuery"
|
|
1007
|
+
description: "Perform an asynchronous HTTP (Ajax) requests with jQuery",
|
|
1008
|
+
extname: ".js"
|
|
1002
1009
|
},
|
|
1003
1010
|
convert: ({ fullUrl, method, allHeaders, postData }, options) => {
|
|
1004
1011
|
const opts = {
|
|
@@ -1062,7 +1069,8 @@ var xhr = {
|
|
|
1062
1069
|
key: "xhr",
|
|
1063
1070
|
title: "XMLHttpRequest",
|
|
1064
1071
|
link: "https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",
|
|
1065
|
-
description: "W3C Standard API that provides scripted client functionality"
|
|
1072
|
+
description: "W3C Standard API that provides scripted client functionality",
|
|
1073
|
+
extname: ".js"
|
|
1066
1074
|
},
|
|
1067
1075
|
convert: ({ postData, allHeaders, method, fullUrl }, options) => {
|
|
1068
1076
|
const opts = {
|
|
@@ -1128,7 +1136,6 @@ var javascript = {
|
|
|
1128
1136
|
info: {
|
|
1129
1137
|
key: "javascript",
|
|
1130
1138
|
title: "JavaScript",
|
|
1131
|
-
extname: ".js",
|
|
1132
1139
|
default: "xhr"
|
|
1133
1140
|
},
|
|
1134
1141
|
clientsById: {
|
|
@@ -1145,7 +1152,8 @@ var native2 = {
|
|
|
1145
1152
|
key: "native",
|
|
1146
1153
|
title: "Native JSON",
|
|
1147
1154
|
link: "https://www.json.org/json-en.html",
|
|
1148
|
-
description: "A JSON represetation of any HAR payload."
|
|
1155
|
+
description: "A JSON represetation of any HAR payload.",
|
|
1156
|
+
extname: ".json"
|
|
1149
1157
|
},
|
|
1150
1158
|
convert: ({ postData }, inputOpts) => {
|
|
1151
1159
|
const opts = {
|
|
@@ -1189,7 +1197,6 @@ var json = {
|
|
|
1189
1197
|
info: {
|
|
1190
1198
|
key: "json",
|
|
1191
1199
|
title: "JSON",
|
|
1192
|
-
extname: ".json",
|
|
1193
1200
|
default: "native"
|
|
1194
1201
|
},
|
|
1195
1202
|
clientsById: {
|
|
@@ -1203,7 +1210,8 @@ var okhttp2 = {
|
|
|
1203
1210
|
key: "okhttp",
|
|
1204
1211
|
title: "OkHttp",
|
|
1205
1212
|
link: "http://square.github.io/okhttp/",
|
|
1206
|
-
description: "An HTTP Request Client Library"
|
|
1213
|
+
description: "An HTTP Request Client Library",
|
|
1214
|
+
extname: ".kt"
|
|
1207
1215
|
},
|
|
1208
1216
|
convert: ({ postData, fullUrl, method, allHeaders }, options) => {
|
|
1209
1217
|
const opts = {
|
|
@@ -1255,7 +1263,6 @@ var kotlin = {
|
|
|
1255
1263
|
info: {
|
|
1256
1264
|
key: "kotlin",
|
|
1257
1265
|
title: "Kotlin",
|
|
1258
|
-
extname: ".kt",
|
|
1259
1266
|
default: "okhttp"
|
|
1260
1267
|
},
|
|
1261
1268
|
clientsById: {
|
|
@@ -1267,7 +1274,8 @@ var axios2 = {
|
|
|
1267
1274
|
key: "axios",
|
|
1268
1275
|
title: "Axios",
|
|
1269
1276
|
link: "https://github.com/axios/axios",
|
|
1270
|
-
description: "Promise based HTTP client for the browser and node.js"
|
|
1277
|
+
description: "Promise based HTTP client for the browser and node.js",
|
|
1278
|
+
extname: ".cjs"
|
|
1271
1279
|
},
|
|
1272
1280
|
convert: ({ method, fullUrl, allHeaders, postData }, options) => {
|
|
1273
1281
|
const opts = {
|
|
@@ -1328,7 +1336,8 @@ var fetch2 = {
|
|
|
1328
1336
|
key: "fetch",
|
|
1329
1337
|
title: "Fetch",
|
|
1330
1338
|
link: "https://github.com/bitinn/node-fetch",
|
|
1331
|
-
description: "Simplified HTTP node-fetch client"
|
|
1339
|
+
description: "Simplified HTTP node-fetch client",
|
|
1340
|
+
extname: ".cjs"
|
|
1332
1341
|
},
|
|
1333
1342
|
convert: ({ method, fullUrl, postData, headersObj, cookies }, options) => {
|
|
1334
1343
|
const opts = {
|
|
@@ -1435,7 +1444,8 @@ var native3 = {
|
|
|
1435
1444
|
key: "native",
|
|
1436
1445
|
title: "HTTP",
|
|
1437
1446
|
link: "http://nodejs.org/api/http.html#http_http_request_options_callback",
|
|
1438
|
-
description: "Node.js native HTTP interface"
|
|
1447
|
+
description: "Node.js native HTTP interface",
|
|
1448
|
+
extname: ".cjs"
|
|
1439
1449
|
},
|
|
1440
1450
|
convert: ({ uriObj, method, allHeaders, postData }, options = {}) => {
|
|
1441
1451
|
const { indent = " " } = options;
|
|
@@ -1500,7 +1510,8 @@ var request = {
|
|
|
1500
1510
|
key: "request",
|
|
1501
1511
|
title: "Request",
|
|
1502
1512
|
link: "https://github.com/request/request",
|
|
1503
|
-
description: "Simplified HTTP request client"
|
|
1513
|
+
description: "Simplified HTTP request client",
|
|
1514
|
+
extname: ".cjs"
|
|
1504
1515
|
},
|
|
1505
1516
|
convert: ({ method, url, fullUrl, postData, headersObj, cookies }, options) => {
|
|
1506
1517
|
const opts = {
|
|
@@ -1587,7 +1598,8 @@ var unirest2 = {
|
|
|
1587
1598
|
key: "unirest",
|
|
1588
1599
|
title: "Unirest",
|
|
1589
1600
|
link: "http://unirest.io/nodejs.html",
|
|
1590
|
-
description: "Lightweight HTTP Request Client Library"
|
|
1601
|
+
description: "Lightweight HTTP Request Client Library",
|
|
1602
|
+
extname: ".cjs"
|
|
1591
1603
|
},
|
|
1592
1604
|
convert: ({ method, url, cookies, queryObj, postData, headersObj }, options) => {
|
|
1593
1605
|
const opts = {
|
|
@@ -1680,7 +1692,6 @@ var node = {
|
|
|
1680
1692
|
info: {
|
|
1681
1693
|
key: "node",
|
|
1682
1694
|
title: "Node.js",
|
|
1683
|
-
extname: ".js",
|
|
1684
1695
|
default: "native",
|
|
1685
1696
|
cli: "node %s"
|
|
1686
1697
|
},
|
|
@@ -1732,7 +1743,8 @@ var nsurlsession = {
|
|
|
1732
1743
|
key: "nsurlsession",
|
|
1733
1744
|
title: "NSURLSession",
|
|
1734
1745
|
link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
|
|
1735
|
-
description: "Foundation's NSURLSession request"
|
|
1746
|
+
description: "Foundation's NSURLSession request",
|
|
1747
|
+
extname: ".m"
|
|
1736
1748
|
},
|
|
1737
1749
|
convert: ({ allHeaders, postData, method, fullUrl }, options) => {
|
|
1738
1750
|
const opts = {
|
|
@@ -1849,7 +1861,6 @@ var objc = {
|
|
|
1849
1861
|
info: {
|
|
1850
1862
|
key: "objc",
|
|
1851
1863
|
title: "Objective-C",
|
|
1852
|
-
extname: ".m",
|
|
1853
1864
|
default: "nsurlsession"
|
|
1854
1865
|
},
|
|
1855
1866
|
clientsById: {
|
|
@@ -1863,7 +1874,8 @@ var cohttp = {
|
|
|
1863
1874
|
key: "cohttp",
|
|
1864
1875
|
title: "CoHTTP",
|
|
1865
1876
|
link: "https://github.com/mirage/ocaml-cohttp",
|
|
1866
|
-
description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml"
|
|
1877
|
+
description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",
|
|
1878
|
+
extname: ".ml"
|
|
1867
1879
|
},
|
|
1868
1880
|
convert: ({ fullUrl, allHeaders, postData, method }, options) => {
|
|
1869
1881
|
const opts = {
|
|
@@ -1910,7 +1922,6 @@ var ocaml = {
|
|
|
1910
1922
|
info: {
|
|
1911
1923
|
key: "ocaml",
|
|
1912
1924
|
title: "OCaml",
|
|
1913
|
-
extname: ".ml",
|
|
1914
1925
|
default: "cohttp"
|
|
1915
1926
|
},
|
|
1916
1927
|
clientsById: {
|
|
@@ -1992,7 +2003,8 @@ var curl = {
|
|
|
1992
2003
|
key: "curl",
|
|
1993
2004
|
title: "cURL",
|
|
1994
2005
|
link: "http://php.net/manual/en/book.curl.php",
|
|
1995
|
-
description: "PHP with ext-curl"
|
|
2006
|
+
description: "PHP with ext-curl",
|
|
2007
|
+
extname: ".php"
|
|
1996
2008
|
},
|
|
1997
2009
|
convert: ({ uriObj, postData, fullUrl, method, httpVersion, cookies, headersObj }, options = {}) => {
|
|
1998
2010
|
const {
|
|
@@ -2108,7 +2120,8 @@ var guzzle = {
|
|
|
2108
2120
|
key: "guzzle",
|
|
2109
2121
|
title: "Guzzle",
|
|
2110
2122
|
link: "http://docs.guzzlephp.org/en/stable/",
|
|
2111
|
-
description: "PHP with Guzzle"
|
|
2123
|
+
description: "PHP with Guzzle",
|
|
2124
|
+
extname: ".php"
|
|
2112
2125
|
},
|
|
2113
2126
|
convert: ({ postData, fullUrl, method, cookies, headersObj }, options) => {
|
|
2114
2127
|
const opts = {
|
|
@@ -2206,7 +2219,8 @@ var http1 = {
|
|
|
2206
2219
|
key: "http1",
|
|
2207
2220
|
title: "HTTP v1",
|
|
2208
2221
|
link: "http://php.net/manual/en/book.http.php",
|
|
2209
|
-
description: "PHP with pecl/http v1"
|
|
2222
|
+
description: "PHP with pecl/http v1",
|
|
2223
|
+
extname: ".php"
|
|
2210
2224
|
},
|
|
2211
2225
|
convert: ({ method, url, postData, queryObj, headersObj, cookiesObj }, options = {}) => {
|
|
2212
2226
|
const { closingTag = false, indent = " ", noTags = false, shortTags = false } = options;
|
|
@@ -2276,7 +2290,8 @@ var http2 = {
|
|
|
2276
2290
|
key: "http2",
|
|
2277
2291
|
title: "HTTP v2",
|
|
2278
2292
|
link: "http://devel-m6w6.rhcloud.com/mdref/http",
|
|
2279
|
-
description: "PHP with pecl/http v2"
|
|
2293
|
+
description: "PHP with pecl/http v2",
|
|
2294
|
+
extname: ".php"
|
|
2280
2295
|
},
|
|
2281
2296
|
convert: ({ postData, headersObj, method, queryObj, cookiesObj, url }, options = {}) => {
|
|
2282
2297
|
const { closingTag = false, indent = " ", noTags = false, shortTags = false } = options;
|
|
@@ -2381,7 +2396,6 @@ var php = {
|
|
|
2381
2396
|
info: {
|
|
2382
2397
|
key: "php",
|
|
2383
2398
|
title: "PHP",
|
|
2384
|
-
extname: ".php",
|
|
2385
2399
|
default: "curl",
|
|
2386
2400
|
cli: "php %s"
|
|
2387
2401
|
},
|
|
@@ -2441,7 +2455,8 @@ var restmethod = {
|
|
|
2441
2455
|
key: "restmethod",
|
|
2442
2456
|
title: "Invoke-RestMethod",
|
|
2443
2457
|
link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",
|
|
2444
|
-
description: "Powershell Invoke-RestMethod client"
|
|
2458
|
+
description: "Powershell Invoke-RestMethod client",
|
|
2459
|
+
extname: ".ps1"
|
|
2445
2460
|
},
|
|
2446
2461
|
convert: generatePowershellConvert("Invoke-RestMethod")
|
|
2447
2462
|
};
|
|
@@ -2452,7 +2467,8 @@ var webrequest = {
|
|
|
2452
2467
|
key: "webrequest",
|
|
2453
2468
|
title: "Invoke-WebRequest",
|
|
2454
2469
|
link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",
|
|
2455
|
-
description: "Powershell Invoke-WebRequest client"
|
|
2470
|
+
description: "Powershell Invoke-WebRequest client",
|
|
2471
|
+
extname: ".ps1"
|
|
2456
2472
|
},
|
|
2457
2473
|
convert: generatePowershellConvert("Invoke-WebRequest")
|
|
2458
2474
|
};
|
|
@@ -2462,7 +2478,6 @@ var powershell = {
|
|
|
2462
2478
|
info: {
|
|
2463
2479
|
key: "powershell",
|
|
2464
2480
|
title: "Powershell",
|
|
2465
|
-
extname: ".ps1",
|
|
2466
2481
|
default: "webrequest"
|
|
2467
2482
|
},
|
|
2468
2483
|
clientsById: {
|
|
@@ -2530,7 +2545,8 @@ var requests = {
|
|
|
2530
2545
|
key: "requests",
|
|
2531
2546
|
title: "Requests",
|
|
2532
2547
|
link: "http://docs.python-requests.org/en/latest/api/#requests.request",
|
|
2533
|
-
description: "Requests HTTP library"
|
|
2548
|
+
description: "Requests HTTP library",
|
|
2549
|
+
extname: ".py"
|
|
2534
2550
|
},
|
|
2535
2551
|
convert: ({ fullUrl, postData, allHeaders, method }, options) => {
|
|
2536
2552
|
const opts = {
|
|
@@ -2657,7 +2673,6 @@ var python = {
|
|
|
2657
2673
|
info: {
|
|
2658
2674
|
key: "python",
|
|
2659
2675
|
title: "Python",
|
|
2660
|
-
extname: ".py",
|
|
2661
2676
|
default: "requests",
|
|
2662
2677
|
cli: "python3 %s"
|
|
2663
2678
|
},
|
|
@@ -2672,7 +2687,8 @@ var httr = {
|
|
|
2672
2687
|
key: "httr",
|
|
2673
2688
|
title: "httr",
|
|
2674
2689
|
link: "https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",
|
|
2675
|
-
description: "httr: Tools for Working with URLs and HTTP"
|
|
2690
|
+
description: "httr: Tools for Working with URLs and HTTP",
|
|
2691
|
+
extname: ".r"
|
|
2676
2692
|
},
|
|
2677
2693
|
convert: ({ url, queryObj, queryString, postData, allHeaders, method }) => {
|
|
2678
2694
|
const { push, blank, join } = new CodeBuilder();
|
|
@@ -2757,7 +2773,6 @@ var r = {
|
|
|
2757
2773
|
info: {
|
|
2758
2774
|
key: "r",
|
|
2759
2775
|
title: "R",
|
|
2760
|
-
extname: ".r",
|
|
2761
2776
|
default: "httr"
|
|
2762
2777
|
},
|
|
2763
2778
|
clientsById: {
|
|
@@ -2771,7 +2786,8 @@ var native4 = {
|
|
|
2771
2786
|
key: "native",
|
|
2772
2787
|
title: "net::http",
|
|
2773
2788
|
link: "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
|
|
2774
|
-
description: "Ruby HTTP client"
|
|
2789
|
+
description: "Ruby HTTP client",
|
|
2790
|
+
extname: ".rb"
|
|
2775
2791
|
},
|
|
2776
2792
|
convert: ({ uriObj, method: rawMethod, fullUrl, postData, allHeaders }) => {
|
|
2777
2793
|
const { push, blank, join } = new CodeBuilder();
|
|
@@ -2831,7 +2847,6 @@ var ruby = {
|
|
|
2831
2847
|
info: {
|
|
2832
2848
|
key: "ruby",
|
|
2833
2849
|
title: "Ruby",
|
|
2834
|
-
extname: ".rb",
|
|
2835
2850
|
default: "native"
|
|
2836
2851
|
},
|
|
2837
2852
|
clientsById: {
|
|
@@ -2877,7 +2892,8 @@ var curl2 = {
|
|
|
2877
2892
|
key: "curl",
|
|
2878
2893
|
title: "cURL",
|
|
2879
2894
|
link: "http://curl.haxx.se/",
|
|
2880
|
-
description: "cURL is a command line tool and library for transferring data with URL syntax"
|
|
2895
|
+
description: "cURL is a command line tool and library for transferring data with URL syntax",
|
|
2896
|
+
extname: ".sh"
|
|
2881
2897
|
},
|
|
2882
2898
|
convert: ({ fullUrl, method, httpVersion, headersObj, allHeaders, postData }, options = {}) => {
|
|
2883
2899
|
const { indent = " ", short = false, binary = false, globOff = false } = options;
|
|
@@ -2990,7 +3006,8 @@ var httpie = {
|
|
|
2990
3006
|
key: "httpie",
|
|
2991
3007
|
title: "HTTPie",
|
|
2992
3008
|
link: "http://httpie.org/",
|
|
2993
|
-
description: "a CLI, cURL-like tool for humans"
|
|
3009
|
+
description: "a CLI, cURL-like tool for humans",
|
|
3010
|
+
extname: ".sh"
|
|
2994
3011
|
},
|
|
2995
3012
|
convert: ({ allHeaders, postData, queryObj, fullUrl, method, url }, options) => {
|
|
2996
3013
|
const opts = {
|
|
@@ -3085,7 +3102,8 @@ var wget = {
|
|
|
3085
3102
|
key: "wget",
|
|
3086
3103
|
title: "Wget",
|
|
3087
3104
|
link: "https://www.gnu.org/software/wget/",
|
|
3088
|
-
description: "a free software package for retrieving files using HTTP, HTTPS"
|
|
3105
|
+
description: "a free software package for retrieving files using HTTP, HTTPS",
|
|
3106
|
+
extname: ".sh"
|
|
3089
3107
|
},
|
|
3090
3108
|
convert: ({ method, postData, allHeaders, fullUrl }, options) => {
|
|
3091
3109
|
const opts = {
|
|
@@ -3123,7 +3141,6 @@ var shell = {
|
|
|
3123
3141
|
info: {
|
|
3124
3142
|
key: "shell",
|
|
3125
3143
|
title: "Shell",
|
|
3126
|
-
extname: ".sh",
|
|
3127
3144
|
default: "curl",
|
|
3128
3145
|
cli: "%s"
|
|
3129
3146
|
},
|
|
@@ -3194,7 +3211,8 @@ var nsurlsession2 = {
|
|
|
3194
3211
|
key: "nsurlsession",
|
|
3195
3212
|
title: "NSURLSession",
|
|
3196
3213
|
link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
|
|
3197
|
-
description: "Foundation's NSURLSession request"
|
|
3214
|
+
description: "Foundation's NSURLSession request",
|
|
3215
|
+
extname: ".swift"
|
|
3198
3216
|
},
|
|
3199
3217
|
convert: ({ allHeaders, postData, fullUrl, method }, options) => {
|
|
3200
3218
|
const opts = {
|
|
@@ -3303,7 +3321,6 @@ var swift = {
|
|
|
3303
3321
|
info: {
|
|
3304
3322
|
key: "swift",
|
|
3305
3323
|
title: "Swift",
|
|
3306
|
-
extname: ".swift",
|
|
3307
3324
|
default: "nsurlsession"
|
|
3308
3325
|
},
|
|
3309
3326
|
clientsById: {
|
|
@@ -3356,9 +3373,6 @@ var isTarget = (target) => {
|
|
|
3356
3373
|
if (!target.info.title) {
|
|
3357
3374
|
throw new Error("target title must be a non-zero-length string");
|
|
3358
3375
|
}
|
|
3359
|
-
if (!Object.prototype.hasOwnProperty.call(target.info, "extname")) {
|
|
3360
|
-
throw new Error("targets must have an `info` object with the property `extname`");
|
|
3361
|
-
}
|
|
3362
3376
|
if (!Object.prototype.hasOwnProperty.call(target, "clientsById") || !target.clientsById || Object.keys(target.clientsById).length === 0) {
|
|
3363
3377
|
throw new Error(
|
|
3364
3378
|
`No clients provided in target ${target.info.key}. You must provide the property \`clientsById\` containg your clients.`
|
|
@@ -3403,6 +3417,9 @@ var isClient = (client) => {
|
|
|
3403
3417
|
if (!Object.prototype.hasOwnProperty.call(client.info, "link")) {
|
|
3404
3418
|
throw new Error("targets client must have an `info` object with property `link`");
|
|
3405
3419
|
}
|
|
3420
|
+
if (!Object.prototype.hasOwnProperty.call(client.info, "extname")) {
|
|
3421
|
+
throw new Error("targets client must have an `info` object with the property `extname`");
|
|
3422
|
+
}
|
|
3406
3423
|
if (!Object.prototype.hasOwnProperty.call(client, "convert") || typeof client.convert !== "function") {
|
|
3407
3424
|
throw new Error("targets client must have a `convert` property containing a conversion function");
|
|
3408
3425
|
}
|
|
@@ -3423,4 +3440,4 @@ var addTargetClient = (targetId, client) => {
|
|
|
3423
3440
|
|
|
3424
3441
|
export { addTarget, addTargetClient, getHeaderName, isClient, isTarget, targets };
|
|
3425
3442
|
//# sourceMappingURL=out.js.map
|
|
3426
|
-
//# sourceMappingURL=chunk-
|
|
3443
|
+
//# sourceMappingURL=chunk-IAWYVBVW.js.map
|