connexion icon indicating copy to clipboard operation
connexion copied to clipboard

Move JSON response body validation to middleware

Open RobbeSneyders opened this issue 2 years ago • 0 comments

This PR moves the JSON response body validation to middleware as another step towards #1525.

I moved away from having the body validators implement the complete ASGI interface and calling the next app as mentioned in #1588, as this is not possible for the response validators. We only know the response content type once the response has started, so we can't wrap the validator around the next app.

Instead, the validator now provides a wrapped receive / send callable depending on if it validates either request or response bodies. I updated the request body validator to match this.

RobbeSneyders avatar Sep 18 '22 10:09 RobbeSneyders