Commit e0c76e3a authored by Dmitriev Sergey's avatar Dmitriev Sergey

Merge pull request #7 from finnhaedicke/value-in-response

store the response value in the response object
parents 1f962496 ca84383f
......@@ -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