drogon icon indicating copy to clipboard operation
drogon copied to clipboard

Does drogon have a recommended way to do parameter validation for HttpRequest?

Open Nevercomes opened this issue 4 years ago • 1 comments

Maybe

  1. Use an annotation like Spring of Java. (impossible)
  2. Use a common filter, and the rules for validation can be transferred into it in a way.
  3. Inject different filter into different HttpController method. (Use if-else in the filter)
  4. Use if-else in every post-put handler method.

Nevercomes avatar Jul 21 '21 08:07 Nevercomes

Thanks for the feature request. Drogon currently doesn’t have a “sanctioned” way to do input validation. The options you already presented are currently the way to go.

This is indeed something I could imagine being part of the core framework.

rbugajewski avatar Jul 21 '21 12:07 rbugajewski

Can someone give some examples for input validation?

rajhlinux avatar Mar 04 '23 03:03 rajhlinux