Enum RetryConditionScope
- Namespace
- Cuemon.AspNetCore.Http.Headers
- Assembly
- Cuemon.AspNetCore.dll
Specifies a set of values defining what value to use with a given HTTP header in regards to a retry condition. Recommended value is always DeltaSeconds as it does not rely on clock synchronization and is resilient to clock skew between client and server.
public enum RetryConditionScope
Fields
DeltaSeconds = 0A non-negative decimal integer indicating the seconds to delay after the response is received.
HttpDate = 1A date after which to retry.
Examples
The following example demonstrates how to use RetryConditionScope to choose the format of a Retry-After header. It compares delta-seconds and absolute-date scopes and prints the resulting header value.
using System;
using System.Net.Http.Headers;
namespace Cuemon.AspNetCore.Http.Headers;
public static class RetryConditionScopeExample
{
public static void Demonstrate()
{
var scope = RetryConditionScope.DeltaSeconds;
string retryAfter = scope == RetryConditionScope.DeltaSeconds
? new RetryConditionHeaderValue(TimeSpan.FromSeconds(30)).ToString()
: new RetryConditionHeaderValue(DateTimeOffset.UtcNow.AddMinutes(1)).ToString();
Console.WriteLine(retryAfter);
}
}