Commit ca84383f authored by Finn Haedicke's avatar Finn Haedicke

store the response value in the response object

parent 1f962496
......@@ -86,6 +86,9 @@ Context.prototype.readResponseLine = function (line) {
code: parseInt(parsed[1]),
result: parsed[2].trim(),
};
if (parsed[3]) {
response.value = parsed[3];
}
//our last command had a pending callback
if (this.pending) {
......
......@@ -103,6 +103,24 @@ describe('Context', function() {
});
});
it('includes the response value', function(done) {
var context = this.context;
process.nextTick(function() {
context.exec('test', 'bang', 'another');
context.stream.write('200');
context.stream.write(' result=0 (a value)\n\n');
});
context.on('response', function(msg) {
expect(msg.code).to.equal(200);
expect(msg.result).to.eql('0');
expect(msg.value).to.eql('a value');
done();
});
});
});
describe('two commands', function(done) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment