Skip to content

Commit

Permalink
fix(bins): update har-validator to promise version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Feb 12, 2016
1 parent 015db0a commit cb362b5
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions lib/routes/bins/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,21 @@ module.exports = function (req, res, next) {

mock.content.size = 0

validate.response(mock, function (err, valid) {
if (!valid) {
res.body = {
errors: err.errors
}

return next()
}
validate.response(mock)
.then(function () {
var id = uuid.v4()

var id = uuid.v4()
this.client.set('bin:' + id, JSON.stringify(mock))

this.client.set('bin:' + id, JSON.stringify(mock))
res.view = 'redirect'
res.status(201).location(util.format('/bin/%s', id)).body = id
}.bind(this))

res.view = 'redirect'
res.status(201).location(util.format('/bin/%s', id)).body = id
.catch(function (err) {
res.body = {
errors: err.errors
}
})

next()
}.bind(this))
.then(next)
}

0 comments on commit cb362b5

Please sign in to comment.