diff --git a/src/targets/node/request.js b/src/targets/node/request.js index 7711d63db..e1f1c28fc 100644 --- a/src/targets/node/request.js +++ b/src/targets/node/request.js @@ -115,7 +115,7 @@ module.exports = function (source, options) { .push('});') .blank() - return code.join().replace('"JAR"', 'jar').replace(/"fs\.createReadStream\(\\"(.+)\\"\)"/, 'fs.createReadStream("$1")') + return code.join().replace('"JAR"', 'jar').replace(/'fs\.createReadStream\(\"(.+)\"\)'/g, 'fs.createReadStream("$1")') } module.exports.info = { diff --git a/test/fixtures/output/node/request/multipart-file.js b/test/fixtures/output/node/request/multipart-file.js index 181affbb6..407757a0f 100644 --- a/test/fixtures/output/node/request/multipart-file.js +++ b/test/fixtures/output/node/request/multipart-file.js @@ -7,7 +7,7 @@ var options = { headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'}, formData: { foo: { - value: 'fs.createReadStream("test/fixtures/files/hello.txt")', + value: fs.createReadStream("test/fixtures/files/hello.txt"), options: {filename: 'test/fixtures/files/hello.txt', contentType: 'text/plain'} } }