protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            if (request.IsInspectRequest())
            {
                var config = GlobalConfiguration.Configuration;

                request.Properties[RequestHelper.RouteDataCache] =
                    new RouteDataInfo
                    {
                        RouteTemplate = request.GetRouteData().Route.RouteTemplate,
                        Data = request.GetRouteData().Values.Select(pair => new KeyValuePair<string, string>(pair.Key, pair.Value.ToString())).ToArray()
                    };

                request.Properties[RequestHelper.RoutesCache] = config.Routes.Select(route =>
                    new RouteInfo
                    {
                        RouteTemplate = route.RouteTemplate,
                        Defaults = route.Defaults != null ? route.Defaults.Select(pair => new KeyValuePair<string, string>(pair.Key, pair.Value.ToString())).ToArray() : null,
                        Constraints = route.Constraints != null ? route.Constraints.Select(pair => new KeyValuePair<string, string>(pair.Key, pair.Value.ToString())).ToArray() : null,
                        DataTokens = route.DataTokens != null ? route.DataTokens.Select(pair => new KeyValuePair<string, string>(pair.Key, pair.Value.ToString())).ToArray() : null,
                        Handler = route.Handler != null ? route.Handler.GetType().Name : null,
                        Picked = route.RouteTemplate == request.GetRouteData().Route.RouteTemplate
                    }).ToArray();

                var response = await base.SendAsync(request, cancellationToken);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    var newRequest = response.RequestMessage;
                    var inspectData = new InspectData(newRequest);
                    inspectData.RealHttpStatus = response.StatusCode;
                    response = newRequest.CreateResponse<InspectData>(HttpStatusCode.OK, inspectData);
                }

                response.Headers.Add(RequestHelper.InspectHeaderName, "done");

                return response;
            }

            return await base.SendAsync(request, cancellationToken);
        }
        public HttpControllerDescriptor SelectController(HttpRequestMessage request)
        {
            if (request.IsInspectRequest())
            {
                var controllers = _innerSelector.GetControllerMapping().Values.Select(desc =>
                    new ControllerSelectionInfo
                    {
                        ControllerName = desc.ControllerName,
                        ControllerType = desc.ControllerType.AssemblyQualifiedName
                    }).ToArray();

                request.Properties[RequestHelper.ControllerCache] = controllers;
            }

            // DefaultHttpControllerSelector.SelectController
            var controllerDescriptor = _innerSelector.SelectController(request);

            // if exception is not thrown
            request.Properties[RequestHelper.SelectedController] = controllerDescriptor.ControllerName;

            return controllerDescriptor;
        }
        public HttpControllerDescriptor SelectController(HttpRequestMessage request)
        {
            if (request.IsInspectRequest())
            {
                var controllers = _delegating.GetControllerMapping().Values.Select(desc =>
                    new
                    {
                        desc.ControllerName,
                        desc.ControllerType,
                    });

                request.Properties[RequestHelper.ControllerCache] = controllers;
            }

            // DefaultHttpControllerSelector.SelectController
            var controllerDescriptor = _delegating.SelectController(request);

            // if exception is not thrown
            request.Properties[RequestHelper.SelectedController] = controllerDescriptor.ControllerName;

            return controllerDescriptor;
        }