The question is how to validate a HTTP request body using Akka HTTP directive? Of course we can use for this reason validate
directive, but it has one drawback which I described in my previous post about a model validation in Akka HTTP. You may want to use require
method, but it is not so functional as well. Today I want to show another way for validation of HTTP request body in Akka.
Tag Archives open source
If you work with Akka HTTP for a while, you should definitely know that it has multiple ways for model validation. I talk about http request body validation. Probably in 99% of cases you would like to ensure that user send something meaningful to the server. So exactly for this purpose Akka HTTP provides validation mechanisms. But what if you want to send back to the client side information about all invalid fields?