Skip to content

Commit 9025a4c

Browse files
author
Sefi Krausz
committed
changes to axios target
1 parent 3cf4b47 commit 9025a4c

1 file changed

Lines changed: 45 additions & 45 deletions

File tree

‎src/targets/node/axios.js‎

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,51 @@ module.exports = function (source, options) {
3333
url: `${source.url}`
3434
};
3535

36-
switch (source.postData.mimeType) {
37-
case 'application/x-www-form-urlencoded':
38-
if (source.postData.paramsObj) {
39-
code.push('req.form(%s);', JSON.stringify(source.postData.paramsObj, null, opts.indent))
40-
}
41-
break
42-
43-
case 'application/json':
44-
if (source.postData.jsonObj) {
45-
code.push('req.type("json");')
46-
.push('req.send(%s);', JSON.stringify(source.postData.jsonObj, null, opts.indent))
47-
}
48-
break
49-
50-
case 'multipart/form-data':
51-
var multipart = []
52-
53-
source.postData.params.forEach(function (param) {
54-
var part = {}
55-
56-
if (param.fileName && !param.value) {
57-
includeFS = true
58-
59-
part.body = 'fs.createReadStream("' + param.fileName + '")'
60-
} else if (param.value) {
61-
part.body = param.value
62-
}
63-
64-
if (part.body) {
65-
if (param.contentType) {
66-
part['content-type'] = param.contentType
67-
}
68-
69-
multipart.push(part)
70-
}
71-
})
72-
73-
code.push('req.multipart(%s);', JSON.stringify(multipart, null, opts.indent))
74-
break
75-
76-
default:
77-
if (source.postData.text) {
78-
code.push(opts.indent + 'req.send(%s);', JSON.stringify(source.postData.text, null, opts.indent))
79-
}
80-
}
36+
// switch (source.postData.mimeType) {
37+
// case 'application/x-www-form-urlencoded':
38+
// if (source.postData.paramsObj) {
39+
// code.push('req.form(%s);', JSON.stringify(source.postData.paramsObj, null, opts.indent))
40+
// }
41+
// break
42+
43+
// case 'application/json':
44+
// if (source.postData.jsonObj) {
45+
// code.push('req.type("json");')
46+
// .push('req.send(%s);', JSON.stringify(source.postData.jsonObj, null, opts.indent))
47+
// }
48+
// break
49+
50+
// case 'multipart/form-data':
51+
// var multipart = []
52+
53+
// source.postData.params.forEach(function (param) {
54+
// var part = {}
55+
56+
// if (param.fileName && !param.value) {
57+
// includeFS = true
58+
59+
// part.body = 'fs.createReadStream("' + param.fileName + '")'
60+
// } else if (param.value) {
61+
// part.body = param.value
62+
// }
63+
64+
// if (part.body) {
65+
// if (param.contentType) {
66+
// part['content-type'] = param.contentType
67+
// }
68+
69+
// multipart.push(part)
70+
// }
71+
// })
72+
73+
// code.push('req.multipart(%s);', JSON.stringify(multipart, null, opts.indent))
74+
// break
75+
76+
// default:
77+
// if (source.postData.text) {
78+
// code.push(opts.indent + 'req.send(%s);', JSON.stringify(source.postData.text, null, opts.indent))
79+
// }
80+
// }
8181

8282
// if (includeFS) {
8383
// code.unshift('var fs = require("fs");')

0 commit comments

Comments
 (0)