예제 #1
0
        private static void addRemainingHeader(IHttpResponse response, ThrottlingConfiguration configuration, RequestCount count)
        {
            string numberOfRequestLeftInPeriod = count != null?
                                                 count.Remaining(configuration.NumberOfRequests).ToString(CultureInfo.InvariantCulture) :
                                                     configuration.FormattedRequests;

            response.AddHeader("X-Rate-Limit-Remaining", numberOfRequestLeftInPeriod);
        }
예제 #2
0
        private static void addResetHeader(IHttpResponse response, ThrottlingConfiguration configuration, RequestCount count)
        {
            string numberOfSecondsLeftInPeriod = count != null?
                                                 count.Remaining(DateTimeOffset.UtcNow).ToString(CultureInfo.InvariantCulture) :
                                                     configuration.FormattedSeconds;

            response.AddHeader("X-Rate-Limit-Reset", numberOfSecondsLeftInPeriod);
        }