Skip to content

Commit

Permalink
Fixed array support. Closes #35 [node]
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 22, 2011
1 parent b735dcb commit 48f8916
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports.protocols = {
*/

function isObject(obj) {
return '[object Object]' == toString.call(obj);
return null != obj && 'object' == typeof obj;
}

/**
Expand Down
11 changes: 11 additions & 0 deletions test/node/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ describe('req.send(Object)', function(){
done();
});
})

it('should work with arrays', function(done){
request
.post('http://localhost:3001/echo')
.send([1,2,3])
.end(function(res){
res.header['content-type'].should.equal('application/json');
res.text.should.equal('[1,2,3]');
done();
});
})

describe('when called several times', function(){
it('should merge the objects', function(done){
Expand Down

0 comments on commit 48f8916

Please sign in to comment.