I use grpc-gateway to host REST api for my grpc service.
I'm have 2 api:
API A
option (google.api.http) = {
post: "/v1/product/{id}"
body: "*"
};
API B
option (google.api.http) = {
post: "/v1/product/unit"
body: "*"
};
but when i call POST v1/product/unit grpc-gateway redirect to the method with the API A. Do i miss something?
It depends on order in which you register your gRPC servers in gateway mux. It's not obvious but you should register more general path (/v1/product/{id}
) before more exact path (/v1/product/uni
). Then you should change order of registration of your gRPC servers in grpc-gatewar ServeMux