Skip to content

Commit

Permalink
fix(test): adapt test to api now returning json on error
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Sep 8, 2017
1 parent 69e0b8c commit 765fe17
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/middleware/couch.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function onGetError(ctx, e, secure) {
if (config.debugrest) {
ctx.body += `\n\n${e}\n${e.stack}`;
}
ctx.body = JSON.stringify({error: ctx.body});
ctx.body = {error: ctx.body};
}

function handleCouchError(ctx, e, secure) {
Expand Down
2 changes: 1 addition & 1 deletion test/rest-api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('basic rest-api as anonymous (noRights)', function () {

it('forbidden datbase names', function () {
return request.get('/db/_a$aa/entry/aaa').expect(403).then((data) => {
data.text.should.equal('invalid database name');
data.body.should.deepEqual({error: 'invalid database name'});
});
});
});
Expand Down

0 comments on commit 765fe17

Please sign in to comment.