System Information
- Strapi Version: 4.3.4
- Operating System: Ubuntu
- Database: PGSQL
- Node Version: 16.17.0
- Yarn Version: 1.22.19
Is it at all possible to run middleware before a policy. We have an endpoint that can take a JSON string or an object, and as a result this means that we need to wrap request.body.data
in a try/catch block. I want to write a piece of middleware that will do this automatically, but because middleware doesn’t run before policies, I still need to do this if I want to do any validation on the request before hitting the controller. Is it at all possible to change the precedence?
Also, as I’m sure people are going to ask, the reason it can take either a JSON string or an object is because (I’m told) having files in the request will only work if the payload is stringified