首页 > 解决方案 > 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?

标签: grpc-gateway

解决方案


推荐阅读