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:
![image](https://private-user-images.githubusercontent.com/249938/293331586-2f336a20-699f-4c3f-b93c-7390fe132f4a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMDI1NTgsIm5iZiI6MTczOTEwMjI1OCwicGF0aCI6Ii8yNDk5MzgvMjkzMzMxNTg2LTJmMzM2YTIwLTY5OWYtNGMzZi1iOTNjLTczOTBmZTEzMmY0YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxMTU3MzhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNmQxYWE2MjUyYjZlNjA3YjQxYzQ1NWFlY2IyMDIzZTQ2OGE3MWYwZDE2MmNlYjEyYzA3NDk1M2FhNmQyYzgzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.6-1oEw64mgM5vA28qiQe1XmK6Li9b-_T-880HnL0wsw)
Beta Was this translation helpful? Give feedback.
All reactions