nlink-community-http-request 1.1.0 → 1.3.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/definition.json +7 -1
- package/execution.js +19 -2
- package/package.json +2 -2
package/definition.json
CHANGED
|
@@ -235,6 +235,11 @@
|
|
|
235
235
|
"name": "params",
|
|
236
236
|
"displayName": "Params",
|
|
237
237
|
"value": "params"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "multipart",
|
|
241
|
+
"displayName": "Multipart",
|
|
242
|
+
"value": "multipart"
|
|
238
243
|
}
|
|
239
244
|
],
|
|
240
245
|
"displayOptions": {
|
|
@@ -286,7 +291,8 @@
|
|
|
286
291
|
true
|
|
287
292
|
],
|
|
288
293
|
"bodyInputType": [
|
|
289
|
-
"params"
|
|
294
|
+
"params",
|
|
295
|
+
"multipart"
|
|
290
296
|
]
|
|
291
297
|
}
|
|
292
298
|
}
|
package/execution.js
CHANGED
|
@@ -62,7 +62,22 @@ if (params.sendHeaders) {
|
|
|
62
62
|
// 3. Body
|
|
63
63
|
var body = null;
|
|
64
64
|
if (params.sendBody) {
|
|
65
|
-
if (params.bodyInputType === '
|
|
65
|
+
if (params.bodyInputType === 'multipart') {
|
|
66
|
+
body = {};
|
|
67
|
+
if (Array.isArray(params.bodyParams)) {
|
|
68
|
+
for (var i = 0; i < params.bodyParams.length; i++) {
|
|
69
|
+
var item = params.bodyParams[i];
|
|
70
|
+
if (item && item.key) {
|
|
71
|
+
var val = item.value;
|
|
72
|
+
if (typeof val === 'object' && val !== null && val.name) {
|
|
73
|
+
body[item.key] = { name: val.name, data: val.data };
|
|
74
|
+
} else {
|
|
75
|
+
body[item.key] = val;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} else if (params.bodyInputType === 'params') {
|
|
66
81
|
var parts = [];
|
|
67
82
|
if (Array.isArray(params.bodyParams)) {
|
|
68
83
|
for (var i = 0; i < params.bodyParams.length; i++) {
|
|
@@ -87,7 +102,9 @@ if (params.sendBody) {
|
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
var resp;
|
|
90
|
-
if (http.
|
|
105
|
+
if (params.sendBody && params.bodyInputType === 'multipart' && http.UploadMultipart) {
|
|
106
|
+
resp = http.UploadMultipart(url, body, headers);
|
|
107
|
+
} else if (http.request) {
|
|
91
108
|
resp = http.request(method, url, body, headers);
|
|
92
109
|
} else if (method === 'GET' && http.get) {
|
|
93
110
|
resp = http.get(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nlink-community-http-request",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "HTTP Request community node for nLink Workflow Platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nlink",
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
"nlink-community.httpRequest"
|
|
17
17
|
]
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|