httpsnippet-client-api 4.1.1 → 4.1.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/package.json +2 -2
- package/src/index.js +16 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "httpsnippet-client-api",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "An HTTP Snippet client for generating snippets for the api module.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"__tests__/__fixtures__/"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "78458869fa5cfdfcc9ae6c2247d97173b7fcc31c"
|
|
48
48
|
}
|
package/src/index.js
CHANGED
|
@@ -213,22 +213,24 @@ module.exports = function (source, options) {
|
|
|
213
213
|
break;
|
|
214
214
|
|
|
215
215
|
case 'multipart/form-data':
|
|
216
|
-
|
|
216
|
+
if (source.postData.params) {
|
|
217
|
+
body = {};
|
|
218
|
+
|
|
219
|
+
// If there's a `Content-Type` header present in the metadata, but it's for the form-data
|
|
220
|
+
// request then dump it off the snippet. We shouldn't offload that unnecessary bloat to the
|
|
221
|
+
// user, instead letting the SDK handle it automatically.
|
|
222
|
+
if ('content-type' in metadata && metadata['content-type'].indexOf('multipart/form-data') === 0) {
|
|
223
|
+
delete metadata['content-type'];
|
|
224
|
+
}
|
|
217
225
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
226
|
+
source.postData.params.forEach(function (param) {
|
|
227
|
+
if (param.fileName) {
|
|
228
|
+
body[param.name] = param.fileName;
|
|
229
|
+
} else {
|
|
230
|
+
body[param.name] = param.value;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
223
233
|
}
|
|
224
|
-
|
|
225
|
-
source.postData.params.forEach(function (param) {
|
|
226
|
-
if (param.fileName) {
|
|
227
|
-
body[param.name] = param.fileName;
|
|
228
|
-
} else {
|
|
229
|
-
body[param.name] = param.value;
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
234
|
break;
|
|
233
235
|
|
|
234
236
|
default:
|