Closed sergioprates closed 7 months ago
I did not add any code specific for http2, so I don't know if this works. I need to check.
@StefH were you ever able to look into the HTTP/2 support (I'm particularly interested in simulating a gRPC api)
From a preliminary look - It is possible to add support for Http2 in the Aspnetcore path by mutating the Protocols on the ListenerOptions. It is not as simple as setting Http1OrHttp2 as there are valid use cases for both that option and Http2 which leads me to think that Protocols should be bubbled up as an option on the WireMockServer.
For example (from Microsoft's gRPC docs):
When an HTTP/2 endpoint is configured without TLS, the endpoint's ListenOptions.Protocols must be set to HttpProtocols.Http2. HttpProtocols.Http1AndHttp2 can't be used because TLS is required to negotiate HTTP/2. Without TLS, all connections to the endpoint default to HTTP/1.1, and gRPC calls fail.
I am currently figuring out how to mock gRPC once HTTP2 support is enabled. I think it could work if I had access to return an HttpResponseMessage...
To get mocking to work ResponseMessage would require some changes to support TrailingHeaders and support for stream bodies or HttpContent - this would require a fair bit of extension.
Thanks for your investigation.
However, this is not yet on my prio list for now.
I looked into this as well. For now, the best approach is probably to use Mountebank server with a Mountebank-grpc plug-in (written in JavaScript) and C# MbDotNet client library. This is obviously a lot of dependencies just to test grpc, but such is life with Google products in my experience: lots and lots of seemingly unnecessary dependencies. - Note: I don't plan to even bother with this as I know my teammates will ridicule me for introducing so many dependencies for stub testing one grpc service one vendor uses.
I created a proxy generator that converts GRPC requests to HTTP and forwards them to WireMock. You might give it a shot. Any feedback you can give me is welcome. The project is available here https://github.com/cezarypiatek/GRPC-Mock-Server
@jzabroski @kharabasz @sergioprates
See https://github.com/WireMock-Net/WireMock.Net/discussions/1045
It's implemented. See also https://mstack.nl/blogs/wiremock-net-grpc/
Hi, In wiremock, since release 2.25.0 has support to make http2 request, but I don't found instructions to do it with WireMock.net. Bellow is the link from release. Is it supported by WireMock.NET? Would be nice if does.
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!searchin/wiremock-user/http$2F2%7Csort:date/wiremock-user/bxG2-yb-u-Y/YlRq94niBQAJ