<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EasyRpc.AspNetCore.Errors;
using EasyRpc.AspNetCore.Filters;
using EasyRpc.AspNetCore.ModelBinding;
using Microsoft.AspNetCore.Http;

namespace EasyRpc.AspNetCore.EndPoints.MethodHandlers
{
    public class StateBasedEndPointMethodHandler<TReturn> : BaseContentEndPointMethodHandler<TReturn>
    {
        private readonly RequestState _startingState;

        /// <inheritdoc />
        public StateBasedEndPointMethodHandler(EndPointMethodConfiguration configuration, BaseEndPointServices services)
            : base(configuration, services)
        {
            if (configuration.Authorizations != null && configuration.Authorizations.Count > 0)
            {
                _startingState = RequestState.CheckAuth;
            }
            else if (configuration.Parameters.Count > 0)
            {
                _startingState = RequestState.BindParameters;
            }
            else if (configuration.Filters != null && configuration.Filters.Count > 0)
            {
                _startingState = RequestState.BeforeExecuteTaskFilter;
            }
            else
            {
                _startingState = RequestState.ExecuteTask;
            }
        }

        /// <inheritdoc />
        public override Task HandleRequest(HttpContext context)
        {
            var requestContext = new RequestExecutionContext(context, this, Configuration.SuccessStatusCode)
            {
                Parameters = EmptyParameters.Instance
            };

            if (InvokeMethodDelegate == null)
            {
                SetupMethod();<commit_msg>reorganizing if statement<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EasyRpc.AspNetCore.Errors;
using EasyRpc.AspNetCore.Filters;
using EasyRpc.AspNetCore.ModelBinding;
using Microsoft.AspNetCore.Http;

namespace EasyRpc.AspNetCore.EndPoints.MethodHandlers
{
    public class StateBasedEndPointMethodHandler<TReturn> : BaseContentEndPointMethodHandler<TReturn>
    {
        private readonly RequestState _startingState;

        /// <inheritdoc />
        public StateBasedEndPointMethodHandler(EndPointMethodConfiguration configuration, BaseEndPointServices services)
            : base(configuration, services)
        {
            _startingState = RequestState.ExecuteTask;

            if (configuration.Authorizations != null && configuration.Authorizations.Count > 0)
            {
                _startingState = RequestState.CheckAuth;
            }
            else if (configuration.Parameters.Count > 0)
            {
                _startingState = RequestState.BindParameters;
            }
            else if (configuration.Filters != null && configuration.Filters.Count > 0)
            {
                _startingState = RequestState.BeforeExecuteTaskFilter;
            }
        }

        /// <inheritdoc />
        public override Task HandleRequest(HttpContext context)
        {
            var requestContext = new RequestExecutionContext(context, this, Configuration.SuccessStatusCode)
            {
                Parameters = EmptyParameters.Instance
            };

            if (InvokeMethodDelegate == null)
            {
                SetupMethod();
{'fraction_non_alphanumeric': 0.07352941176470588, 'fraction_numerical': 0.0017647058823529412, 'mean_word_length': 2.267050912584054, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6081672', 'n_tokens_mistral': 792, 'n_tokens_neox': 793, 'n_words': 156}