Extract request decoding into a middleware

Decode the request and populate the env before continuing up the stack.
If a decoding error occurs, rescue it, set the response and don't
continue up the stack.