github/hubot-scripts — pull request #1432 by wking (2014-04-30 21:30:23+00:00)
Title: github-commits: Don't parse req.body (it's already an object)

Avoid:

github-commits error: SyntaxError: Unexpected token u. Payload: undefined

because req.body is already parsed by the time github-commits sees it. The
original github-commits code was added in 6e7ce2a (notify in chat when a new
commit is pushed, 2012-08-15), but Hubot added the bodyParser middleware in
github/hubot@4f4c8c7 (Use bodyParser middleware to parse POST bodys [sic], 2011-12-24), so
I'm not sure how this ever worked. From the express docs for req.body [1]:

This property is an object containing the parsed request body. This
feature is provided by the bodyParser() middleware, though other
body parsing middleware may follow this convention as well. This
property defaults to {} when bodyParser() is used.

Besides removing the parsing, I've renamed the generic 'payload' to the more
specific 'push' for most of the script body, because
'req.body' is already a generic identifier, and I want to keep the parsed
variable isolated from future changes to the calling API.

[1]: http://expressjs.com/3x/api.html#req.body