HA4IoT.Networking.Http.HttpRequestController.ExecuteActions C# (CSharp) Method

ExecuteActions() private method

private ExecuteActions ( object sender, HttpRequestReceivedEventArgs e ) : void
sender object
e HttpRequestReceivedEventArgs
return void
        private void ExecuteActions(object sender, HttpRequestReceivedEventArgs e)
        {
            string requestUri = e.Context.Request.Uri.Trim('/');

            if (!requestUri.StartsWith(_baseUri, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            string relativeUri = requestUri.Substring(_baseUri.Length).Trim('/');

            foreach (var handler in _handlers)
            {
                if (!handler.Method.Equals(e.Context.Request.Method))
                {
                    continue;
                }

                if (handler.HandleRequestsWithDifferentSubUrl)
                {
                    if (!relativeUri.StartsWith(handler.Uri))
                    {
                        continue;
                    }
                }
                else
                {
                    if (!handler.Uri.Equals(relativeUri))
                    {
                        continue;
                    }
                }

                InvokeHandlerAction(handler, e.Context);
                e.IsHandled = true;
                return;
            }
        }