nlink-community-http-request 1.1.0 → 1.3.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/definition.json CHANGED
@@ -286,7 +286,8 @@
286
286
  true
287
287
  ],
288
288
  "bodyInputType": [
289
- "params"
289
+ "params",
290
+ "multipart"
290
291
  ]
291
292
  }
292
293
  }
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 === 'params') {
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.request) {
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.1.0",
3
+ "version": "1.3.1",
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
+ }