Replies: 5 comments 9 replies
-
Beta Was this translation helpful? Give feedback.
-
Just wanted to say well done, @StefH ! That looks very good. I think having the ability to specify the proto definition at the server level would be a useful thing to have, especially when it contains multiple request / reply definitions. You can then load the proto definition once and define specific responses for individual requests in separate mock definitions. |
Beta Was this translation helpful? Give feedback.
-
I'm curious to see what |
Beta Was this translation helpful? Give feedback.
-
I haven't played much with GRPC, but I feel like option 3 is almost a must have. I've often seen repos to define rpc messages so it can be reused across teams, so having a way to import the full definition seems it would be used the most. Having a way to also define per message can also be useful when prototyping stuff, so I see 1 and 3 like something that would be used. |
Beta Was this translation helpful? Give feedback.
-
gRPC support is implemented in PR (#1047) Read this blog post on the details and how to use it: https://mstack.nl/blogs/wiremock-net-grpc/ |
Beta Was this translation helpful? Give feedback.
-
Grpc
Currently, gRPC functionality is supported via this project: https://github.com/cezarypiatek/GRPC-Mock-Server
Grpc support : request - reply
However, I want to discuss an idea here to add simple Grpc request-reply logic to WireMock.Net
This will look a bit like the GraphQL support which is added recently, combined with some ideas from MimePartMatcher.
However in case of protobuf, the binary protobuf bytes are converted to a json object. (using ProtoBufJsonConverter).
So that a normal JsonMatcher can be used.
Usage
Usage in C# will be like:
Notes
A. It's not yet possible to get the request message as a (Json) object, so you cannot yet use transformer on{{request.BodyAsJson}}
A. It is also possible to use transformer on the request (as json object).
B. Maybe the ProtoDefinition can also defined at server-level, in that case theWithBodyAsProtoBuf
will not require a full proto definition, but just a name-reference or guid.B. It is possible to define the ProtoDefinition at server-level (see option 3)
PR
#1047
Example
I did test it in PostMan, and it works fine:
Beta Was this translation helpful? Give feedback.
All reactions