Inspired by #1356:  Make handling of req.body much more robust and
RFC-compliant.

Fixes #1356