Table of Contents

RetryConditionScope Enum

Definition

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 = 0

A non-negative decimal integer indicating the seconds to delay after the response is received.

HttpDate = 1

A 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.

// Program.cs
using System;
using System.Net.Http.Headers;
using Cuemon.AspNetCore.Http.Headers;

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);