Skip to content

Commit 7468bea

Browse files
author
Sefi Krausz
committed
RAP2-1431 added useQueryString: true to nodejs snippets
1 parent 91734de commit 7468bea

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/targets/node/axios.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module.exports = function (source, options) {
5454
indent: ' '
5555
}, options)
5656

57-
console.log({source})
5857
let code = new CodeBuilder(opts.indent)
5958

6059
code.push('const axios = require("axios");')
@@ -65,7 +64,8 @@ module.exports = function (source, options) {
6564
url: `${source.url}`,
6665
headers: {
6766
'content-type': `${source.postData.mimeType}`,
68-
...(Object.keys(source.headersObj).length && source.headersObj)
67+
...(Object.keys(source.headersObj).length && source.headersObj),
68+
'useQueryString': true
6969
},
7070
params: Object.keys(source.queryObj).length ? source.queryObj : undefined
7171
};

src/targets/node/native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ module.exports = function (source, options) {
1717
var opts = Object.assign({
1818
indent: ' '
1919
}, options)
20-
console.log({source})
20+
2121
var code = new CodeBuilder(opts.indent)
2222

2323
var reqOpts = {
2424
method: source.method,
2525
hostname: source.uriObj.hostname,
2626
port: source.uriObj.port,
2727
path: source.uriObj.path,
28-
headers: source.allHeaders
28+
headers: { ...source.allHeaders, useQueryString: true }
2929
}
3030

3131
code.push('var http = require("%s");', source.uriObj.protocol.replace(':', ''))

src/targets/node/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function (source, options) {
1818
var opts = Object.assign({
1919
indent: ' '
2020
}, options)
21-
console.log({source})
21+
2222
var includeFS = false
2323
var code = new CodeBuilder(opts.indent)
2424

@@ -35,7 +35,7 @@ module.exports = function (source, options) {
3535
}
3636

3737
if (Object.keys(source.headersObj).length) {
38-
reqOpts.headers = source.headersObj
38+
reqOpts.headers = {...source.headersObj,useQueryString: true}
3939
}
4040

4141
switch (source.postData.mimeType) {

src/targets/node/unirest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function (source, options) {
1616
var opts = Object.assign({
1717
indent: ' '
1818
}, options)
19-
console.log({source})
19+
2020
var includeFS = false
2121
var code = new CodeBuilder(opts.indent)
2222

@@ -42,7 +42,7 @@ module.exports = function (source, options) {
4242
}
4343

4444
if (Object.keys(source.headersObj).length) {
45-
code.push('req.headers(%s);', JSON.stringify(source.headersObj, null, opts.indent))
45+
code.push('req.headers(%s);', JSON.stringify({...source.headersObj, useQueryString: true}, null, opts.indent))
4646
.blank()
4747
}
4848

0 commit comments

Comments
 (0)