mirror of
https://github.com/samsonjs/ThePusher.git
synced 2026-03-25 09:15:57 +00:00
extract data from payload before responding to http request
This commit is contained in:
parent
249efd3705
commit
eabe7ea220
1 changed files with 15 additions and 8 deletions
23
pusher.js
23
pusher.js
|
|
@ -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'
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue