Closed havarnov closed 4 years ago
Hi @havarnov, so, I actually implemented this already for the new release.
Check it out in this branch, and let me know what you think.
Hi @havarnov, so, I actually implemented this already for the new release.
Check it out in this branch, and let me know what you think.
Aha, I didn't realize. Then I guess you can discard this PR.
I have tested the 4-release branch and it works for my use case. I'm using the ControllerBase.ProzyAsync
method.
I do have one suggestion on those methods, what about using the following pattern?
public static Task ProxyAsync(this ControllerBase controller, string httpEndpoint, string wsEndpoint, Action<HttpProxyOptions> httpProxyOptionsBuilder = null, Action<WsProxyOptions> wsProxyOptionsBuilder = null);
@havarnov, I had thought about doing that.
The problem is that it encourages bad behavior. The builder methods are great for the Startup
methods because I can "build" the resulting routes on your behalf on startup once.
The problem with using the builders with the ProxyAsync
extension method is that that method is run every invocation, and the builders would get "built" every invocation. In general, this is not terrible, but it is a bad habit to get into, when the options are likely static for every invocation. If they aren't, then you can still "build" the options earlier in the invocation to your controller endpoint.
Does that make sense?
Closing in favor of 4.0.0 release.
Didn't find a good way to test this, but if you have any ideas I'll gladly add a test.