Exemplo n.º 1
0
 public async Task Invoke(HttpContext context)
 {
     using (var response = await _proxyOptions.HandleProxyRequest(context))
     {
         await CopyProxyHttpResponse(context, response);
     }
 }
Exemplo n.º 2
0
        public Task Invoke(HttpContext context)
        {
            var requestContext = new RequestContext(context.Request);
            var proxyReponse   = _proxyOptions.HandleProxyRequest(requestContext);

            if (proxyReponse.StatusCode != null)
            {
                context.Response.StatusCode = (int)proxyReponse.StatusCode;
                return(Task.CompletedTask);
            }

            return(context.ProxyRequest(proxyReponse.DestinationUri, _proxyOptions, _httpClientFactory));
        }