extract data from payload before responding to http request

This commit is contained in:
Sami Samhuri 2011-06-05 10:54:25 -07:00
parent 249efd3705
commit eabe7ea220

View file

@ -171,17 +171,24 @@ function routeRequest(req, res) {
return
}
try {
var action
, owner = payload.repository.owner.name
, repo = payload.repository.name
, ref = payload.ref
, branch = ref.match(/^refs\/heads\//) ? ref.split('/')[2] : null
, tag = ref.match(/^refs\/tags\//) ? ref.split('/')[2] : null
, refType = branch ? 'branch' : tag ? 'tag' : 'unknown'
} catch (e) {
console.error('!!! malformed payload: ' + e)
console.error(e.stack)
badRequest(req, res)
return
}
res.writeHead(204)
res.end()
var action
, owner = payload.repository.owner.name
, repo = payload.repository.name
, ref = payload.ref
, branch = ref.match(/^refs\/heads\//) ? ref.split('/')[2] : null
, tag = ref.match(/^refs\/tags\//) ? ref.split('/')[2] : null
, refType = branch ? 'branch' : tag ? 'tag' : 'unknown'
if (payload.created) {
action = 'create'
}