private ApiThrottlingResult PerSymbol(IOwinRequest request)
        {
            var value = ReadBody(request);

            if (value == null)
            {
                throw new RequiredParameterIsNotSpecifiedException("Text not found");
            }
            int requestCost = (int)Math.Ceiling((double)value.Length / _throttleThisAttribute.Cost);

            return(_apiThrottler.Throttle(request, requestCost));
        }
Beispiel #2
0
        private ApiThrottlingResult PerSymbol(IOwinRequest request)
        {
            StreamReader reader = new StreamReader(request.Body, Encoding.UTF8);
            var          value  = reader.ReadToEnd();

            request.Body.Position = 0;
            if (value == null)
            {
                throw new RequiredParameterIsNotSpecifiedException("Text not found");
            }
            int requestCost = (int)Math.Ceiling((double)value.Length / _throttleThisAttribute.Cost);

            return(_apiThrottler.Throttle(request, requestCost));
        }