【发布时间】:2014-09-08 17:49:54
【问题描述】:
我正在尝试断言响应正文是否为空,但出现错误:
var api = supertest(TEST_URL);
...
api.get('..')
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) {
return done(err);
}
res.should.have.status(200);
// Uncaught AssertionError: expected {} to have a property 'length'
// res.body.should.empty;
// Workaround should be used
res.text.should.eql('{}');
怎么了?我该如何解决这个问题?
【问题讨论】:
-
我怎样才能断言body是空的,即带有
res.send()的sendet
标签: node.js supertest should.js