@readme/httpsnippet 5.0.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/code-builder.js +1 -1
- package/dist/helpers/form-data.js +2 -2
- package/dist/helpers/headers.js +1 -1
- package/dist/helpers/reducer.js +1 -1
- package/dist/helpers/shell.js +1 -1
- package/dist/helpers/utils.js +1 -1
- package/dist/index.js +14 -25
- package/dist/targets/c/libcurl/client.js +3 -3
- package/dist/targets/c/target.js +4 -4
- package/dist/targets/clojure/clj_http/client.js +10 -7
- package/dist/targets/clojure/target.js +4 -4
- package/dist/targets/csharp/httpclient/client.js +4 -4
- package/dist/targets/csharp/restsharp/client.js +3 -3
- package/dist/targets/csharp/target.js +4 -4
- package/dist/targets/go/native/client.js +3 -3
- package/dist/targets/go/target.js +4 -4
- package/dist/targets/http/http1.1/client.js +3 -3
- package/dist/targets/http/target.js +4 -4
- package/dist/targets/java/asynchttp/client.js +3 -3
- package/dist/targets/java/nethttp/client.js +3 -3
- package/dist/targets/java/okhttp/client.js +3 -3
- package/dist/targets/java/target.js +4 -4
- package/dist/targets/java/unirest/client.js +3 -3
- package/dist/targets/javascript/axios/client.js +6 -6
- package/dist/targets/javascript/axios/fixtures/application-form-encoded.js +5 -4
- package/dist/targets/javascript/axios/fixtures/application-json.js +4 -3
- package/dist/targets/javascript/axios/fixtures/cookies.js +4 -3
- package/dist/targets/javascript/axios/fixtures/custom-method.js +4 -3
- package/dist/targets/javascript/axios/fixtures/full.js +5 -4
- package/dist/targets/javascript/axios/fixtures/headers.js +4 -3
- package/dist/targets/javascript/axios/fixtures/http-insecure.js +4 -3
- package/dist/targets/javascript/axios/fixtures/jsonObj-multiline.js +4 -3
- package/dist/targets/javascript/axios/fixtures/jsonObj-null-value.js +4 -3
- package/dist/targets/javascript/axios/fixtures/multipart-data.js +4 -3
- package/dist/targets/javascript/axios/fixtures/multipart-file.js +4 -3
- package/dist/targets/javascript/axios/fixtures/multipart-form-data-no-params.js +4 -3
- package/dist/targets/javascript/axios/fixtures/multipart-form-data.js +4 -3
- package/dist/targets/javascript/axios/fixtures/nested.js +4 -3
- package/dist/targets/javascript/axios/fixtures/postdata-malformed.js +4 -3
- package/dist/targets/javascript/axios/fixtures/query-encoded.js +4 -3
- package/dist/targets/javascript/axios/fixtures/query.js +4 -3
- package/dist/targets/javascript/axios/fixtures/short.js +4 -3
- package/dist/targets/javascript/axios/fixtures/text-plain.js +4 -3
- package/dist/targets/javascript/fetch/client.js +6 -6
- package/dist/targets/javascript/fetch/fixtures/application-form-encoded.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/application-json.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/cookies.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/custom-method.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/full.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/headers.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/http-insecure.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/jsonObj-multiline.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/jsonObj-null-value.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/multipart-data.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/multipart-file.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data-no-params.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/multipart-form-data.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/nested.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/postdata-malformed.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/query-encoded.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/query.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/short.js +2 -1
- package/dist/targets/javascript/fetch/fixtures/text-plain.js +2 -1
- package/dist/targets/javascript/jquery/client.js +5 -5
- package/dist/targets/javascript/target.js +4 -4
- package/dist/targets/javascript/xhr/client.js +5 -5
- package/dist/targets/kotlin/okhttp/client.js +3 -3
- package/dist/targets/kotlin/target.js +4 -4
- package/dist/targets/node/axios/client.js +5 -5
- package/dist/targets/node/axios/fixtures/application-form-encoded.js +3 -2
- package/dist/targets/node/axios/fixtures/application-json.js +2 -1
- package/dist/targets/node/axios/fixtures/cookies.js +2 -1
- package/dist/targets/node/axios/fixtures/custom-method.js +2 -1
- package/dist/targets/node/axios/fixtures/full.js +3 -2
- package/dist/targets/node/axios/fixtures/headers.js +2 -1
- package/dist/targets/node/axios/fixtures/http-insecure.js +2 -1
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +2 -1
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +2 -1
- package/dist/targets/node/axios/fixtures/multipart-data.js +2 -1
- package/dist/targets/node/axios/fixtures/multipart-file.js +2 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +2 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data.js +2 -1
- package/dist/targets/node/axios/fixtures/nested.js +2 -1
- package/dist/targets/node/axios/fixtures/postdata-malformed.js +2 -1
- package/dist/targets/node/axios/fixtures/query-encoded.js +2 -1
- package/dist/targets/node/axios/fixtures/query.js +2 -1
- package/dist/targets/node/axios/fixtures/short.js +2 -1
- package/dist/targets/node/axios/fixtures/text-plain.js +2 -1
- package/dist/targets/node/fetch/client.js +6 -6
- package/dist/targets/node/fetch/fixtures/application-form-encoded.js +2 -1
- package/dist/targets/node/fetch/fixtures/application-json.js +2 -1
- package/dist/targets/node/fetch/fixtures/cookies.js +2 -1
- package/dist/targets/node/fetch/fixtures/custom-method.js +2 -1
- package/dist/targets/node/fetch/fixtures/full.js +2 -1
- package/dist/targets/node/fetch/fixtures/headers.js +2 -1
- package/dist/targets/node/fetch/fixtures/http-insecure.js +2 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-multiline.js +2 -1
- package/dist/targets/node/fetch/fixtures/jsonObj-null-value.js +2 -1
- package/dist/targets/node/fetch/fixtures/multipart-data.js +2 -1
- package/dist/targets/node/fetch/fixtures/multipart-file.js +2 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data-no-params.js +2 -1
- package/dist/targets/node/fetch/fixtures/multipart-form-data.js +2 -1
- package/dist/targets/node/fetch/fixtures/nested.js +2 -1
- package/dist/targets/node/fetch/fixtures/postdata-malformed.js +2 -1
- package/dist/targets/node/fetch/fixtures/query-encoded.js +2 -1
- package/dist/targets/node/fetch/fixtures/query.js +2 -1
- package/dist/targets/node/fetch/fixtures/short.js +2 -1
- package/dist/targets/node/fetch/fixtures/text-plain.js +2 -1
- package/dist/targets/node/native/client.js +10 -10
- package/dist/targets/node/request/client.js +7 -7
- package/dist/targets/node/target.js +5 -5
- package/dist/targets/node/unirest/client.js +10 -10
- package/dist/targets/objc/helpers.js +1 -1
- package/dist/targets/objc/nsurlsession/client.js +4 -4
- package/dist/targets/objc/target.js +4 -4
- package/dist/targets/ocaml/cohttp/client.js +3 -3
- package/dist/targets/ocaml/target.js +4 -4
- package/dist/targets/php/curl/client.js +12 -12
- package/dist/targets/php/guzzle/client.js +5 -5
- package/dist/targets/php/helpers.js +1 -1
- package/dist/targets/php/http1/client.js +3 -3
- package/dist/targets/php/http2/client.js +4 -4
- package/dist/targets/php/target.js +5 -5
- package/dist/targets/powershell/common.js +1 -1
- package/dist/targets/powershell/restmethod/client.js +3 -3
- package/dist/targets/powershell/target.js +4 -4
- package/dist/targets/powershell/webrequest/client.js +3 -3
- package/dist/targets/python/helpers.js +1 -1
- package/dist/targets/python/requests/client.js +3 -3
- package/dist/targets/python/target.js +5 -5
- package/dist/targets/r/httr/client.js +3 -3
- package/dist/targets/r/target.js +4 -4
- package/dist/targets/ruby/native/client.js +3 -3
- package/dist/targets/ruby/target.js +4 -4
- package/dist/targets/shell/curl/client.js +9 -6
- package/dist/targets/shell/httpie/client.js +4 -4
- package/dist/targets/shell/target.js +5 -5
- package/dist/targets/shell/wget/client.js +3 -3
- package/dist/targets/swift/helpers.js +1 -1
- package/dist/targets/swift/nsurlsession/client.js +4 -4
- package/dist/targets/swift/target.js +4 -4
- package/dist/targets/targets.js +4 -4
- package/package.json +12 -13
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.native = void 0;
|
|
18
18
|
var stringify_object_1 = __importDefault(require("stringify-object"));
|
|
19
19
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
@@ -22,7 +22,7 @@ exports.native = {
|
|
|
22
22
|
key: 'native',
|
|
23
23
|
title: 'HTTP',
|
|
24
24
|
link: 'http://nodejs.org/api/http.html#http_http_request_options_callback',
|
|
25
|
-
description: 'Node.js native HTTP interface'
|
|
25
|
+
description: 'Node.js native HTTP interface',
|
|
26
26
|
},
|
|
27
27
|
convert: function (_a, options) {
|
|
28
28
|
var _b;
|
|
@@ -34,11 +34,11 @@ exports.native = {
|
|
|
34
34
|
hostname: uriObj.hostname,
|
|
35
35
|
port: uriObj.port,
|
|
36
36
|
path: uriObj.path,
|
|
37
|
-
headers: allHeaders
|
|
37
|
+
headers: allHeaders,
|
|
38
38
|
};
|
|
39
39
|
push("const http = require('".concat((_b = uriObj.protocol) === null || _b === void 0 ? void 0 : _b.replace(':', ''), "');"));
|
|
40
40
|
blank();
|
|
41
|
-
push("const options = ".concat((0, stringify_object_1
|
|
41
|
+
push("const options = ".concat((0, stringify_object_1.default)(reqOpts, { indent: opts.indent }), ";"));
|
|
42
42
|
blank();
|
|
43
43
|
push('const req = http.request(options, function (res) {');
|
|
44
44
|
push('const chunks = [];', 1);
|
|
@@ -57,26 +57,26 @@ exports.native = {
|
|
|
57
57
|
case 'application/x-www-form-urlencoded':
|
|
58
58
|
if (postData.paramsObj) {
|
|
59
59
|
unshift("const qs = require('querystring');");
|
|
60
|
-
push("req.write(qs.stringify(".concat((0, stringify_object_1
|
|
60
|
+
push("req.write(qs.stringify(".concat((0, stringify_object_1.default)(postData.paramsObj, {
|
|
61
61
|
indent: ' ',
|
|
62
|
-
inlineCharacterLimit: 80
|
|
62
|
+
inlineCharacterLimit: 80,
|
|
63
63
|
}), "));"));
|
|
64
64
|
}
|
|
65
65
|
break;
|
|
66
66
|
case 'application/json':
|
|
67
67
|
if (postData.jsonObj) {
|
|
68
|
-
push("req.write(JSON.stringify(".concat((0, stringify_object_1
|
|
68
|
+
push("req.write(JSON.stringify(".concat((0, stringify_object_1.default)(postData.jsonObj, {
|
|
69
69
|
indent: ' ',
|
|
70
|
-
inlineCharacterLimit: 80
|
|
70
|
+
inlineCharacterLimit: 80,
|
|
71
71
|
}), "));"));
|
|
72
72
|
}
|
|
73
73
|
break;
|
|
74
74
|
default:
|
|
75
75
|
if (postData.text) {
|
|
76
|
-
push("req.write(".concat((0, stringify_object_1
|
|
76
|
+
push("req.write(".concat((0, stringify_object_1.default)(postData.text, { indent: opts.indent }), ");"));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
push('req.end();');
|
|
80
80
|
return join();
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
82
|
};
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.request = void 0;
|
|
18
18
|
var stringify_object_1 = __importDefault(require("stringify-object"));
|
|
19
19
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
@@ -22,7 +22,7 @@ exports.request = {
|
|
|
22
22
|
key: 'request',
|
|
23
23
|
title: 'Request',
|
|
24
24
|
link: 'https://github.com/request/request',
|
|
25
|
-
description: 'Simplified HTTP request client'
|
|
25
|
+
description: 'Simplified HTTP request client',
|
|
26
26
|
},
|
|
27
27
|
convert: function (_a, options) {
|
|
28
28
|
var method = _a.method, url = _a.url, fullUrl = _a.fullUrl, postData = _a.postData, headersObj = _a.headersObj, cookies = _a.cookies;
|
|
@@ -33,7 +33,7 @@ exports.request = {
|
|
|
33
33
|
blank();
|
|
34
34
|
var reqOpts = {
|
|
35
35
|
method: method,
|
|
36
|
-
url: fullUrl
|
|
36
|
+
url: fullUrl,
|
|
37
37
|
};
|
|
38
38
|
if (Object.keys(headersObj).length) {
|
|
39
39
|
reqOpts.headers = headersObj;
|
|
@@ -65,8 +65,8 @@ exports.request = {
|
|
|
65
65
|
value: "fs.createReadStream(".concat(param.fileName, ")"),
|
|
66
66
|
options: {
|
|
67
67
|
filename: param.fileName,
|
|
68
|
-
contentType: param.contentType ? param.contentType : null
|
|
69
|
-
}
|
|
68
|
+
contentType: param.contentType ? param.contentType : null,
|
|
69
|
+
},
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
else if (param.value) {
|
|
@@ -95,7 +95,7 @@ exports.request = {
|
|
|
95
95
|
if (includeFS) {
|
|
96
96
|
unshift("const fs = require('fs');");
|
|
97
97
|
}
|
|
98
|
-
push("const options = ".concat((0, stringify_object_1
|
|
98
|
+
push("const options = ".concat((0, stringify_object_1.default)(reqOpts, { indent: ' ', inlineCharacterLimit: 80 }), ";"));
|
|
99
99
|
blank();
|
|
100
100
|
push('request(options, function (error, response, body) {');
|
|
101
101
|
push('if (error) throw new Error(error);', 1);
|
|
@@ -103,5 +103,5 @@ exports.request = {
|
|
|
103
103
|
push('console.log(body);', 1);
|
|
104
104
|
push('});');
|
|
105
105
|
return join();
|
|
106
|
-
}
|
|
106
|
+
},
|
|
107
107
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.node = void 0;
|
|
4
4
|
var client_1 = require("./axios/client");
|
|
5
5
|
var client_2 = require("./fetch/client");
|
|
@@ -11,14 +11,14 @@ exports.node = {
|
|
|
11
11
|
key: 'node',
|
|
12
12
|
title: 'Node.js',
|
|
13
13
|
extname: '.js',
|
|
14
|
-
|
|
15
|
-
cli: 'node %s'
|
|
14
|
+
default: 'native',
|
|
15
|
+
cli: 'node %s',
|
|
16
16
|
},
|
|
17
17
|
clientsById: {
|
|
18
18
|
native: client_3.native,
|
|
19
19
|
request: client_4.request,
|
|
20
20
|
unirest: client_5.unirest,
|
|
21
21
|
axios: client_1.axios,
|
|
22
|
-
fetch: client_2.fetch
|
|
23
|
-
}
|
|
22
|
+
fetch: client_2.fetch,
|
|
23
|
+
},
|
|
24
24
|
};
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.unirest = void 0;
|
|
18
18
|
var stringify_object_1 = __importDefault(require("stringify-object"));
|
|
19
19
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
@@ -22,14 +22,14 @@ exports.unirest = {
|
|
|
22
22
|
key: 'unirest',
|
|
23
23
|
title: 'Unirest',
|
|
24
24
|
link: 'http://unirest.io/nodejs.html',
|
|
25
|
-
description: 'Lightweight HTTP Request Client Library'
|
|
25
|
+
description: 'Lightweight HTTP Request Client Library',
|
|
26
26
|
},
|
|
27
27
|
convert: function (_a, options) {
|
|
28
28
|
var method = _a.method, url = _a.url, cookies = _a.cookies, queryObj = _a.queryObj, postData = _a.postData, headersObj = _a.headersObj;
|
|
29
29
|
var opts = __assign({ indent: ' ' }, options);
|
|
30
30
|
var includeFS = false;
|
|
31
31
|
var _b = new code_builder_1.CodeBuilder({
|
|
32
|
-
indent: opts.indent
|
|
32
|
+
indent: opts.indent,
|
|
33
33
|
}), addPostProcessor = _b.addPostProcessor, blank = _b.blank, join = _b.join, push = _b.push, unshift = _b.unshift;
|
|
34
34
|
push("const unirest = require('unirest');");
|
|
35
35
|
blank();
|
|
@@ -44,24 +44,24 @@ exports.unirest = {
|
|
|
44
44
|
blank();
|
|
45
45
|
}
|
|
46
46
|
if (Object.keys(queryObj).length) {
|
|
47
|
-
push("req.query(".concat((0, stringify_object_1
|
|
47
|
+
push("req.query(".concat((0, stringify_object_1.default)(queryObj, { indent: opts.indent }), ");"));
|
|
48
48
|
blank();
|
|
49
49
|
}
|
|
50
50
|
if (Object.keys(headersObj).length) {
|
|
51
|
-
push("req.headers(".concat((0, stringify_object_1
|
|
51
|
+
push("req.headers(".concat((0, stringify_object_1.default)(headersObj, { indent: opts.indent }), ");"));
|
|
52
52
|
blank();
|
|
53
53
|
}
|
|
54
54
|
switch (postData.mimeType) {
|
|
55
55
|
case 'application/x-www-form-urlencoded':
|
|
56
56
|
if (postData.paramsObj) {
|
|
57
|
-
push("req.form(".concat((0, stringify_object_1
|
|
57
|
+
push("req.form(".concat((0, stringify_object_1.default)(postData.paramsObj, { indent: opts.indent }), ");"));
|
|
58
58
|
blank();
|
|
59
59
|
}
|
|
60
60
|
break;
|
|
61
61
|
case 'application/json':
|
|
62
62
|
if (postData.jsonObj) {
|
|
63
63
|
push("req.type('json');");
|
|
64
|
-
push("req.send(".concat((0, stringify_object_1
|
|
64
|
+
push("req.send(".concat((0, stringify_object_1.default)(postData.jsonObj, { indent: opts.indent }), ");"));
|
|
65
65
|
blank();
|
|
66
66
|
}
|
|
67
67
|
break;
|
|
@@ -87,13 +87,13 @@ exports.unirest = {
|
|
|
87
87
|
multipart_1.push(part);
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
push("req.multipart(".concat((0, stringify_object_1
|
|
90
|
+
push("req.multipart(".concat((0, stringify_object_1.default)(multipart_1, { indent: opts.indent }), ");"));
|
|
91
91
|
blank();
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default:
|
|
95
95
|
if (postData.text) {
|
|
96
|
-
push("req.send(".concat((0, stringify_object_1
|
|
96
|
+
push("req.send(".concat((0, stringify_object_1.default)(postData.text, { indent: opts.indent }), ");"));
|
|
97
97
|
blank();
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -106,5 +106,5 @@ exports.unirest = {
|
|
|
106
106
|
push('console.log(res.body);', 1);
|
|
107
107
|
push('});');
|
|
108
108
|
return join();
|
|
109
|
-
}
|
|
109
|
+
},
|
|
110
110
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.literalRepresentation = exports.nsDeclaration = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Create a string corresponding to a valid declaration and initialization of an Objective-C object literal.
|
|
@@ -26,7 +26,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
26
26
|
}
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
|
-
exports
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.nsurlsession = void 0;
|
|
31
31
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
32
32
|
var helpers_1 = require("../helpers");
|
|
@@ -35,7 +35,7 @@ exports.nsurlsession = {
|
|
|
35
35
|
key: 'nsurlsession',
|
|
36
36
|
title: 'NSURLSession',
|
|
37
37
|
link: 'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',
|
|
38
|
-
description: "Foundation's NSURLSession request"
|
|
38
|
+
description: "Foundation's NSURLSession request",
|
|
39
39
|
},
|
|
40
40
|
convert: function (_a, options) {
|
|
41
41
|
var allHeaders = _a.allHeaders, postData = _a.postData, method = _a.method, fullUrl = _a.fullUrl;
|
|
@@ -44,7 +44,7 @@ exports.nsurlsession = {
|
|
|
44
44
|
// Markers for headers to be created as literal objects and later be set on the NSURLRequest if exist
|
|
45
45
|
var req = {
|
|
46
46
|
hasHeaders: false,
|
|
47
|
-
hasBody: false
|
|
47
|
+
hasBody: false,
|
|
48
48
|
};
|
|
49
49
|
// We just want to make sure people understand that is the only dependency
|
|
50
50
|
push('#import <Foundation/Foundation.h>');
|
|
@@ -138,5 +138,5 @@ exports.nsurlsession = {
|
|
|
138
138
|
push(' }];');
|
|
139
139
|
push('[dataTask resume];');
|
|
140
140
|
return join();
|
|
141
|
-
}
|
|
141
|
+
},
|
|
142
142
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.objc = void 0;
|
|
4
4
|
var client_1 = require("./nsurlsession/client");
|
|
5
5
|
exports.objc = {
|
|
@@ -7,9 +7,9 @@ exports.objc = {
|
|
|
7
7
|
key: 'objc',
|
|
8
8
|
title: 'Objective-C',
|
|
9
9
|
extname: '.m',
|
|
10
|
-
|
|
10
|
+
default: 'nsurlsession',
|
|
11
11
|
},
|
|
12
12
|
clientsById: {
|
|
13
|
-
nsurlsession: client_1.nsurlsession
|
|
14
|
-
}
|
|
13
|
+
nsurlsession: client_1.nsurlsession,
|
|
14
|
+
},
|
|
15
15
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.cohttp = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
exports.cohttp = {
|
|
@@ -18,7 +18,7 @@ exports.cohttp = {
|
|
|
18
18
|
key: 'cohttp',
|
|
19
19
|
title: 'CoHTTP',
|
|
20
20
|
link: 'https://github.com/mirage/ocaml-cohttp',
|
|
21
|
-
description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml'
|
|
21
|
+
description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml',
|
|
22
22
|
},
|
|
23
23
|
convert: function (_a, options) {
|
|
24
24
|
var fullUrl = _a.fullUrl, allHeaders = _a.allHeaders, postData = _a.postData, method = _a.method;
|
|
@@ -59,5 +59,5 @@ exports.cohttp = {
|
|
|
59
59
|
push('>>= fun (res, body_stream) ->');
|
|
60
60
|
push('(* Do stuff with the result *)', 1);
|
|
61
61
|
return join();
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
63
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ocaml = void 0;
|
|
4
4
|
var client_1 = require("./cohttp/client");
|
|
5
5
|
exports.ocaml = {
|
|
@@ -7,9 +7,9 @@ exports.ocaml = {
|
|
|
7
7
|
key: 'ocaml',
|
|
8
8
|
title: 'OCaml',
|
|
9
9
|
extname: '.ml',
|
|
10
|
-
|
|
10
|
+
default: 'cohttp',
|
|
11
11
|
},
|
|
12
12
|
clientsById: {
|
|
13
|
-
cohttp: client_1.cohttp
|
|
14
|
-
}
|
|
13
|
+
cohttp: client_1.cohttp,
|
|
14
|
+
},
|
|
15
15
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.curl = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
exports.curl = {
|
|
@@ -18,7 +18,7 @@ exports.curl = {
|
|
|
18
18
|
key: 'curl',
|
|
19
19
|
title: 'cURL',
|
|
20
20
|
link: 'http://php.net/manual/en/book.curl.php',
|
|
21
|
-
description: 'PHP with ext-curl'
|
|
21
|
+
description: 'PHP with ext-curl',
|
|
22
22
|
},
|
|
23
23
|
convert: function (_a, options) {
|
|
24
24
|
var uriObj = _a.uriObj, postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method, httpVersion = _a.httpVersion, cookies = _a.cookies, headersObj = _a.headersObj;
|
|
@@ -34,47 +34,47 @@ exports.curl = {
|
|
|
34
34
|
{
|
|
35
35
|
escape: true,
|
|
36
36
|
name: 'CURLOPT_PORT',
|
|
37
|
-
value: uriObj.port
|
|
37
|
+
value: uriObj.port,
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
escape: true,
|
|
41
41
|
name: 'CURLOPT_URL',
|
|
42
|
-
value: fullUrl
|
|
42
|
+
value: fullUrl,
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
escape: false,
|
|
46
46
|
name: 'CURLOPT_RETURNTRANSFER',
|
|
47
|
-
value: 'true'
|
|
47
|
+
value: 'true',
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
escape: true,
|
|
51
51
|
name: 'CURLOPT_ENCODING',
|
|
52
|
-
value: ''
|
|
52
|
+
value: '',
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
escape: false,
|
|
56
56
|
name: 'CURLOPT_MAXREDIRS',
|
|
57
|
-
value: opts.maxRedirects
|
|
57
|
+
value: opts.maxRedirects,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
escape: false,
|
|
61
61
|
name: 'CURLOPT_TIMEOUT',
|
|
62
|
-
value: opts.timeout
|
|
62
|
+
value: opts.timeout,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
escape: false,
|
|
66
66
|
name: 'CURLOPT_HTTP_VERSION',
|
|
67
|
-
value: httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1'
|
|
67
|
+
value: httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1',
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
escape: true,
|
|
71
71
|
name: 'CURLOPT_CUSTOMREQUEST',
|
|
72
|
-
value: method
|
|
72
|
+
value: method,
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
escape: true,
|
|
76
76
|
name: 'CURLOPT_POSTFIELDS',
|
|
77
|
-
value: postData ? postData.text : undefined
|
|
77
|
+
value: postData ? postData.text : undefined,
|
|
78
78
|
},
|
|
79
79
|
];
|
|
80
80
|
push('curl_setopt_array($curl, [');
|
|
@@ -122,5 +122,5 @@ exports.curl = {
|
|
|
122
122
|
push('?>');
|
|
123
123
|
}
|
|
124
124
|
return join();
|
|
125
|
-
}
|
|
125
|
+
},
|
|
126
126
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.guzzle = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
var headers_1 = require("../../../helpers/headers");
|
|
@@ -20,7 +20,7 @@ exports.guzzle = {
|
|
|
20
20
|
key: 'guzzle',
|
|
21
21
|
title: 'Guzzle',
|
|
22
22
|
link: 'http://docs.guzzlephp.org/en/stable/',
|
|
23
|
-
description: 'PHP with Guzzle'
|
|
23
|
+
description: 'PHP with Guzzle',
|
|
24
24
|
},
|
|
25
25
|
convert: function (_a, options) {
|
|
26
26
|
var postData = _a.postData, fullUrl = _a.fullUrl, method = _a.method, cookies = _a.cookies, headersObj = _a.headersObj;
|
|
@@ -44,7 +44,7 @@ exports.guzzle = {
|
|
|
44
44
|
var field = {
|
|
45
45
|
name: param.name,
|
|
46
46
|
filename: param.fileName,
|
|
47
|
-
contents: param.value
|
|
47
|
+
contents: param.value,
|
|
48
48
|
};
|
|
49
49
|
if (param.contentType) {
|
|
50
50
|
field.headers = { 'Content-Type': param.contentType };
|
|
@@ -54,7 +54,7 @@ exports.guzzle = {
|
|
|
54
54
|
else if (param.value) {
|
|
55
55
|
fields_1.push({
|
|
56
56
|
name: param.name,
|
|
57
|
-
contents: param.value
|
|
57
|
+
contents: param.value,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
});
|
|
@@ -113,5 +113,5 @@ exports.guzzle = {
|
|
|
113
113
|
push('?>');
|
|
114
114
|
}
|
|
115
115
|
return join();
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
117
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.http1 = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
var helpers_1 = require("../helpers");
|
|
@@ -19,7 +19,7 @@ exports.http1 = {
|
|
|
19
19
|
key: 'http1',
|
|
20
20
|
title: 'HTTP v1',
|
|
21
21
|
link: 'http://php.net/manual/en/book.http.php',
|
|
22
|
-
description: 'PHP with pecl/http v1'
|
|
22
|
+
description: 'PHP with pecl/http v1',
|
|
23
23
|
},
|
|
24
24
|
convert: function (_a, options) {
|
|
25
25
|
var method = _a.method, url = _a.url, postData = _a.postData, queryObj = _a.queryObj, headersObj = _a.headersObj, cookiesObj = _a.cookiesObj;
|
|
@@ -77,5 +77,5 @@ exports.http1 = {
|
|
|
77
77
|
push('?>');
|
|
78
78
|
}
|
|
79
79
|
return join();
|
|
80
|
-
}
|
|
80
|
+
},
|
|
81
81
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.http2 = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
var headers_1 = require("../../../helpers/headers");
|
|
@@ -20,7 +20,7 @@ exports.http2 = {
|
|
|
20
20
|
key: 'http2',
|
|
21
21
|
title: 'HTTP v2',
|
|
22
22
|
link: 'http://devel-m6w6.rhcloud.com/mdref/http',
|
|
23
|
-
description: 'PHP with pecl/http v2'
|
|
23
|
+
description: 'PHP with pecl/http v2',
|
|
24
24
|
},
|
|
25
25
|
convert: function (_a, options) {
|
|
26
26
|
var postData = _a.postData, headersObj = _a.headersObj, method = _a.method, queryObj = _a.queryObj, cookiesObj = _a.cookiesObj, url = _a.url;
|
|
@@ -54,7 +54,7 @@ exports.http2 = {
|
|
|
54
54
|
name: name,
|
|
55
55
|
type: contentType,
|
|
56
56
|
file: fileName,
|
|
57
|
-
data: value
|
|
57
|
+
data: value,
|
|
58
58
|
});
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -115,5 +115,5 @@ exports.http2 = {
|
|
|
115
115
|
push('?>');
|
|
116
116
|
}
|
|
117
117
|
return join();
|
|
118
|
-
}
|
|
118
|
+
},
|
|
119
119
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.php = void 0;
|
|
4
4
|
var client_1 = require("./curl/client");
|
|
5
5
|
var client_2 = require("./guzzle/client");
|
|
@@ -10,13 +10,13 @@ exports.php = {
|
|
|
10
10
|
key: 'php',
|
|
11
11
|
title: 'PHP',
|
|
12
12
|
extname: '.php',
|
|
13
|
-
|
|
14
|
-
cli: 'php %s'
|
|
13
|
+
default: 'curl',
|
|
14
|
+
cli: 'php %s',
|
|
15
15
|
},
|
|
16
16
|
clientsById: {
|
|
17
17
|
curl: client_1.curl,
|
|
18
18
|
guzzle: client_2.guzzle,
|
|
19
19
|
http1: client_3.http1,
|
|
20
|
-
http2: client_4.http2
|
|
21
|
-
}
|
|
20
|
+
http2: client_4.http2,
|
|
21
|
+
},
|
|
22
22
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.restmethod = void 0;
|
|
4
4
|
var common_1 = require("../common");
|
|
5
5
|
exports.restmethod = {
|
|
@@ -7,7 +7,7 @@ exports.restmethod = {
|
|
|
7
7
|
key: 'restmethod',
|
|
8
8
|
title: 'Invoke-RestMethod',
|
|
9
9
|
link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod',
|
|
10
|
-
description: 'Powershell Invoke-RestMethod client'
|
|
10
|
+
description: 'Powershell Invoke-RestMethod client',
|
|
11
11
|
},
|
|
12
|
-
convert: (0, common_1.generatePowershellConvert)('Invoke-RestMethod')
|
|
12
|
+
convert: (0, common_1.generatePowershellConvert)('Invoke-RestMethod'),
|
|
13
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.powershell = void 0;
|
|
4
4
|
var client_1 = require("./restmethod/client");
|
|
5
5
|
var client_2 = require("./webrequest/client");
|
|
@@ -8,10 +8,10 @@ exports.powershell = {
|
|
|
8
8
|
key: 'powershell',
|
|
9
9
|
title: 'Powershell',
|
|
10
10
|
extname: '.ps1',
|
|
11
|
-
|
|
11
|
+
default: 'webrequest',
|
|
12
12
|
},
|
|
13
13
|
clientsById: {
|
|
14
14
|
webrequest: client_2.webrequest,
|
|
15
|
-
restmethod: client_1.restmethod
|
|
16
|
-
}
|
|
15
|
+
restmethod: client_1.restmethod,
|
|
16
|
+
},
|
|
17
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webrequest = void 0;
|
|
4
4
|
var common_1 = require("../common");
|
|
5
5
|
exports.webrequest = {
|
|
@@ -7,7 +7,7 @@ exports.webrequest = {
|
|
|
7
7
|
key: 'webrequest',
|
|
8
8
|
title: 'Invoke-WebRequest',
|
|
9
9
|
link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest',
|
|
10
|
-
description: 'Powershell Invoke-WebRequest client'
|
|
10
|
+
description: 'Powershell Invoke-WebRequest client',
|
|
11
11
|
},
|
|
12
|
-
convert: (0, common_1.generatePowershellConvert)('Invoke-WebRequest')
|
|
12
|
+
convert: (0, common_1.generatePowershellConvert)('Invoke-WebRequest'),
|
|
13
13
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.requests = void 0;
|
|
15
15
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
16
16
|
var headers_1 = require("../../../helpers/headers");
|
|
@@ -20,7 +20,7 @@ exports.requests = {
|
|
|
20
20
|
key: 'requests',
|
|
21
21
|
title: 'Requests',
|
|
22
22
|
link: 'http://docs.python-requests.org/en/latest/api/#requests.request',
|
|
23
|
-
description: 'Requests HTTP library'
|
|
23
|
+
description: 'Requests HTTP library',
|
|
24
24
|
},
|
|
25
25
|
convert: function (_a, options) {
|
|
26
26
|
var fullUrl = _a.fullUrl, postData = _a.postData, allHeaders = _a.allHeaders, method = _a.method;
|
|
@@ -157,5 +157,5 @@ exports.requests = {
|
|
|
157
157
|
// Print response
|
|
158
158
|
push('print(response.text)');
|
|
159
159
|
return join();
|
|
160
|
-
}
|
|
160
|
+
},
|
|
161
161
|
};
|