Add ability to wrap response in an envelope

Updates #507 from @Japh for 2.0.

Fixes #370.
Agreed; we have a finite space here to operate in. Let's break this to another discussion.