As a TODO comment notes:
// TODO: use a ParamValidator to check field value, etc!
Currently, JsonBodyValidator does not perform any type check, which means that handlers could break horribly if they don't do the validation themselves (which they shouldn't do!).
Solution outline:
- add getParsedBody and setParsedBody to RequestInterface (T357025), following PSR-7.
- add parseBodyData to Handler. It should throw for unsupported body types, and return null if the handler wants to process the body as a stream.
- The router object should call parseBodyData on the handler, and pass the result to the request (T358557)
- The router object should ensure that requests that should have a body do have one, and requests that shouldn't don't have a body.