grpc-gateway - grpc-gateway how to make validation work for http request as well?
问题描述
I have build a grpc/http sever with grpcecosystem/grpc-gateway and I use go-proto-validators to generate validation code, it works well in grpc with grpc.UnaryInterceptor.
However, the http requests seems not pass through the validation function. Add a http middleware did not work, because the validation can be done only after the http request has been passed into protobuf data structures, which are implemented by the auto-generated code, modify every function is obviously meaningless.
Is there a way to solve this problem execpt call validate function manually in every rpc function?
解决方案
推荐阅读
- mysql - 在 Glassfish 5 中配置 Oracle MySQL 云服务
- javascript - 如何根据 Javascript 变量设置网页上图像的位置?
- angular - 我可以停止 forEach 直到我通过 promise-then 从服务器获取数据吗?
- angular - 角度5下拉保留值
- javascript - Javascript JSON.stringify 返回 []
- swift - Swift XMLParser // 根据元素和属性选择节点
- wordpress - 如何在 WordPress 中创建自定义日历?
- r - 在图表上标记特定点
- javascript - 为用户替换网站上的千位分隔符
- android - 我们需要强制语言环境还是默认强制?