mirror of
https://github.com/samsonjs/ThePusher.git
synced 2026-03-25 09:15:57 +00:00
don't call callback twice on failure in parseRequest
This commit is contained in:
parent
f2ab481b6f
commit
249efd3705
1 changed files with 6 additions and 3 deletions
|
|
@ -146,13 +146,16 @@ function parseRequest(req, cb) {
|
|||
req.on('data', function(b) { parts.push(b) })
|
||||
req.on('end', function() {
|
||||
var body = parts.join('')
|
||||
, err = null
|
||||
, data
|
||||
try {
|
||||
cb(null, JSON.parse(querystring.parse(body).payload))
|
||||
data = JSON.parse(querystring.parse(body).payload)
|
||||
}
|
||||
catch (err) {
|
||||
catch (e) {
|
||||
err = e
|
||||
err.body = body
|
||||
cb(err)
|
||||
}
|
||||
cb(err, data)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue