Add ability to wrap response in an envelope

Updates #507 from @Japh for 2.0.

Fixes #370.
I hate all of these magic request arguments. There's no better way to do this?