fix filter for boolean value false (#412) (#413)

This commit is contained in:
Jan Trienes
2016-11-21 02:24:35 +01:00
committed by typicode
parent b5eec153f7
commit eca6b763f2
2 changed files with 9 additions and 1 deletions

View File

@ -120,7 +120,7 @@ module.exports = (db, name) => {
const path = key.replace(/(_lte|_gte|_ne|_like)$/, '')
const elementValue = _.get(element, path)
if (!elementValue) {
if (elementValue == null) {
return
}

View File

@ -194,6 +194,14 @@ describe('Server', () => {
.expect([ db.comments[3] ])
.expect(200, done)
})
it('should support filtering by boolean value false', (done) => {
request(server)
.get('/comments?published=false')
.expect('Content-Type', /json/)
.expect([ db.comments[1], db.comments[2], db.comments[4] ])
.expect(200, done)
})
})
describe('GET /:resource?_end=', () => {