Replies: 1 comment 1 reply
-
That doesn't exist as a pre-built feature, but most of what you'd need already exists as part of the TestServer. It even has an HttpClient API that bypasses sockets to communicate in-memory. Here are the raw components I expect you could copy and reassemble: aspnetcore/src/Hosting/TestHost/src/TestServer.cs Lines 102 to 160 in f0bb131 https://github.com/dotnet/aspnetcore/blob/f0bb1315cc057a6b7f17418c48762d51c0218a0f/src/Hosting/TestHost/src/ClientHandler.cs https://github.com/dotnet/aspnetcore/blob/f0bb1315cc057a6b7f17418c48762d51c0218a0f/src/Hosting/TestHost/src/HttpContextBuilder.cs I'd expect you to convert TestServer from an IServer to a middleware so it could inject requests into the pipeline. You'll also probably need a singleton DI service for the TestServer to provide access to its HttpClient. I'm curious to see the results. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to call a webapi service, webapi2, from another webapi service, webapi1. That sounds easy easy enough. However, the Filters and pipeline don't get called when calling webapi2 from webapi1. However, for my application's architecture, I would like to call webap 2 and get the Filters and pipeline to apply on inter-service calls.
HttpClient works, but the overhead is pretty high. Too high, in fact. It results in serialization and deserialization, leaving to the OS' network, creating sockets, etc. So I want a local call that bypasses serialization, and stays in the code, much like how WCF had a local channel. https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/local-channel
If the code doesn't exist, but extensibility is there, I'm willing to write it, if someone can point me to the right interfaces, etc.
Beta Was this translation helpful? Give feedback.
All reactions