/// <summary> /// Proxies a request inside of a controller's method body from the request on the controller's route. /// </summary> /// <param name="controller">The ASP.NET <see cref="ControllerBase"/>.</param> /// <param name="httpEndpoint">The HTTP endpoint to use.</param> /// <param name="wsEndpoint">The WS endpoint to use.</param> /// <param name="httpProxyOptions">The HTTP options.</param> /// <param name="wsProxyOptions">The WS options.</param> /// <returns>A <see cref="Task"/> which completes when the request has been successfully proxied and written to the response.</returns> public static Task ProxyAsync(this ControllerBase controller, string httpEndpoint, string wsEndpoint, HttpProxyOptions httpProxyOptions = null, WsProxyOptions wsProxyOptions = null) { var httpProxy = new HttpProxy((c, a) => new ValueTask <string>(httpEndpoint), httpProxyOptions); var wsProxy = new WsProxy((c, a) => new ValueTask <string>(wsEndpoint), wsProxyOptions); var proxy = new Builders.Proxy(null, httpProxy, wsProxy); return(controller.HttpContext.ExecuteProxyOperationAsync(proxy)); }
/// <summary> /// Proxies a request inside of a controller's method body from the request on the controller's route. /// </summary> /// <param name="controller">The ASP.NET <see cref="ControllerBase"/>.</param> /// <param name="wsEndpoint">The WS endpoint to use.</param> /// <param name="wsProxyOptions">The WS options.</param> /// <returns>A <see cref="Task"/> which completes when the request has been successfully proxied and written to the response.</returns> public static Task WsProxyAsync(this ControllerBase controller, string wsEndpoint, WsProxyOptions wsProxyOptions = null) { var wsProxy = new WsProxy((c, a) => new ValueTask <string>(wsEndpoint), wsProxyOptions); return(controller.HttpContext.ExecuteWsProxyOperationAsync(wsProxy)); }
internal WsProxy(EndpointComputerToValueTask endpointComputer, WsProxyOptions options) { EndpointComputer = endpointComputer; Options = options; }