diff --git a/src/websrv.js b/src/websrv.js index a1e0267..f80aa53 100644 --- a/src/websrv.js +++ b/src/websrv.js @@ -27,17 +27,17 @@ function Websrv(tbot, tsql, tlib) { var body = ''; req.on('data', (data) => { body += data; - if(body.length > 1e6) { + if(body.length > 1e6) req.connection.destroy(); - } }); req.on('end', () => { - console.log(body); + body = JSON.parse(body); + //lib.log(body.commits); var eventname = body.event_name; var autor = body.user_name; - var commit = body.commits[body.commits[total_commits_count]-1].message; - bot.log( eventname + ' from ' + autor + ' ('+commit+')' ); + var commit = body.commits[body.commits.length-1].message.replace('\n',''); + lib.log( eventname + ' from ' + autor + ' ('+commit+')' ); }); res.writeHead(200, { 'Content-Type': 'text/html' }); res.end('muh', 'utf-8');