Skip to content

Commit f33ce57

Browse files
author
Sefi Krausz
committed
changes to axios target
1 parent 21efe4f commit f33ce57

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/targets/node/axios.js‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,23 @@ module.exports = function (source, options) {
3131
'content-type': `${source.postData.mimeType}`,
3232
...(Object.keys(source.headersObj).length && source.headersObj)
3333
},
34+
params: Object.keys(source.queryObj).length && source.queryObj,
3435
url: `${source.url}`,
3536
};
3637

37-
code.push(`axios(${JSON.stringify(requestOptions)})`)
38+
code.push(`axios(
39+
${JSON.stringify(requestOptions)}
40+
)`)
41+
.blank()
42+
.push(`.then(
43+
(response)=>{
44+
console.log(response)
45+
})`)
46+
.blank()
47+
.push(`.catch(
48+
(error)=>{
49+
console.log(error)
50+
})`)
3851
.blank()
3952

4053
//TODO implement params

0 commit comments

Comments
 (0)