mirror of
https://github.com/samsonjs/ThePusher.git
synced 2026-04-27 15:07:43 +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
13
pusher.js
13
pusher.js
|
|
@ -171,9 +171,7 @@ function routeRequest(req, res) {
|
|||
return
|
||||
}
|
||||
|
||||
res.writeHead(204)
|
||||
res.end()
|
||||
|
||||
try {
|
||||
var action
|
||||
, owner = payload.repository.owner.name
|
||||
, repo = payload.repository.name
|
||||
|
|
@ -181,6 +179,15 @@ function routeRequest(req, res) {
|
|||
, 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()
|
||||
|
||||
if (payload.created) {
|
||||
action = 'create'
|
||||
|
|
|
|||
Loading…
Reference in a new issue