Ensure we have a valid event before acting

- Moved logic for determining if we have:
  - an error
  - with an HTTP request
  - that Accepts a JSON mediatype
  to a new method.
- onRender() and onDispatchError() both use the new method.

Fixes an issue reported by @spiffyjr in IRC.