Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,36 @@ For example:
res.should.have.header('Content-Length');
res.should.have.header('Content-Type', 'text/html');

## Testing non-html responses

You can also use tobi to test non-html end-points.

// JSON
browser.get('/json', function(res, obj){
obj.should.eql({ user: 'tj' });
done();
});

// Test JSON response from a link click
browser.get('/users', function(res, $){
$('a').click(function(res, obj){
obj.should.eql([
{ name: 'tobi' }
, { name: 'loki' }
, { name: 'jane' }
]);
done();
});
});

// XML
browser.request('GET', '/xml', {}, function(res){
res.should.have.header('Content-Type', 'application/xml');
res.should.not.have.property('body');
done();
});


## Testing

Install the deps:
Expand Down