mirror of
https://github.com/samsonjs/ThePusher.git
synced 2026-04-26 14:57:38 +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('data', function(b) { parts.push(b) })
|
||||||
req.on('end', function() {
|
req.on('end', function() {
|
||||||
var body = parts.join('')
|
var body = parts.join('')
|
||||||
|
, err = null
|
||||||
|
, data
|
||||||
try {
|
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
|
err.body = body
|
||||||
cb(err)
|
|
||||||
}
|
}
|
||||||
|
cb(err, data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue