Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: config.replace (#634)
Browse files Browse the repository at this point in the history
* Fixed config.replace. Should fix #633

* not expecting anuy response any more when sending one file

* un-only test
  • Loading branch information
pgte authored and daviddias committed Nov 22, 2017
1 parent a8b4ea6 commit 79d79c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/config/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

const streamifier = require('streamifier')
const promisify = require('promisify-es6')
const SendOneFile = require('../utils/send-one-file')

module.exports = (send) => {
const sendOneFile = SendOneFile(send, 'config/replace')
return promisify((config, callback) => {
if (typeof config === 'object') {
config = streamifier.createReadStream(Buffer.from(JSON.stringify(config)))
}

send({
path: 'config/replace',
files: config,
buffer: true
}, callback)
sendOneFile(config, {}, callback)
})
}
3 changes: 0 additions & 3 deletions src/utils/send-one-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = (send, path) => {
if (err) {
return callback(err)
}
if (results.length !== 1) {
return callback(new Error('expected 1 result and had ' + results.length))
}
callback(null, results[0])
})
}
Expand Down

0 comments on commit 79d79c5

Please sign in to comment.