Exemple #1
0
        private async Task RequestDelegate(HttpContext context)
        {
            try
            {
                var options = _apiManager.CreateProductProxyOptions(context);

                if (options == null)
                {
                    context.Response.StatusCode = (int)HttpStatusCode.NotFound;
                    await context.Response.WriteAsync("NotFound");
                }
                else
                {
                    if (!RunInboundPolicy(context, options))
                    {
                        //Policy must set "HttpStatusCode" and-or content
                        return;
                    }

                    //await TempBackendCall(context, options);
                    await proxy.WormholeProxy.HandleHttpRequestX(context, options.BackendBaseUri);

                    RunOutboundPolicy(context, options);
                }
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                await context.Response.WriteAsync(ex.ToString());
            }
        }