pmlopes/yoke — pull request #70 by danthegoodman (2014-01-30 07:21:13+00:00)
Title: Refactor and enhance the BodyParser

I may have gone a little overboard on my refactoring. If you'd like me to fix anything or undo one of my refactors, let me know - I'll be glad to.

I added one feature: If the content type is unknown or not provided, I save the body as a `Buffer`. Previously, it was being thrown away.

I added a test for it.

Here's a list of my refactors:

* Generally repleaced large if/else blocks with if-return blocks
* `parseJson`: Flattened nested try/catch decode exception blocks
* extracted `hasNoBody` to communicate a lack of body
* Replaced `isJSON/is...` boolean fields with an enum for all of the handled content types
* Extracted the upload handler block into it's own method
* Extracted the data handler block into it's own method
* Disabled the data handler if we aren't putting stuff into the buffer