コード例 #1
0
        public async Task InvokeAsync(HttpContext httpContext)
        {
            var req = httpContext.Request;

            using (var op = SnTrace.Web.StartOperation($"{req.Method} {req.GetDisplayUrl()}"))
            {
                // set request size limit if configured
                if (_requestOptions?.MaxRequestBodySize > 0)
                {
                    httpContext.Features.Get <IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize =
                        _requestOptions.MaxRequestBodySize;
                }

                // Create OData-response strategy
                var odataRequest = ODataRequest.Parse(httpContext);

                // Write headers and body of the HttpResponse
                await ProcessRequestAsync(httpContext, odataRequest).ConfigureAwait(false);

                op.Successful = true;
            }

            // Call next in the chain if exists
            if (_next != null)
            {
                await _next(httpContext).ConfigureAwait(false);
            }
        }
コード例 #2
0
        public async Task InvokeAsync(HttpContext httpContext)
        {
            // Create OData-response strategy
            var odataRequest = ODataRequest.Parse(httpContext);

            // Write headers and body of the HttpResponse
            await ProcessRequestAsync(httpContext, odataRequest).ConfigureAwait(false);

            // Call next in the chain if exists
            if (_next != null)
            {
                await _next(httpContext).ConfigureAwait(false);
            }
        }