PipelineResponseHeaders
public abstract class PipelineResponseHeaders : IEnumerable<KeyValuePair<string, string>>, IEnumerable
A collection of HTTP response headers and their values.
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace System.ClientModel.Primitives
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class PipelineResponseHeaders : IEnumerable<KeyValuePair<string, string>>, IEnumerable
{
private const string RetryAfterHeaderName = "Retry-After";
public abstract bool TryGetValue(string name, [System.Runtime.CompilerServices.Nullable(2)] out string value);
public abstract bool TryGetValues(string name, [System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1
})] out IEnumerable<string> values);
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
1
})]
public abstract IEnumerator<KeyValuePair<string, string>> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
internal static bool TryGetRetryAfter(PipelineResponse response, out TimeSpan value)
{
if (response.Headers.TryGetValue("Retry-After", out string value2)) {
if (int.TryParse(value2, out int result)) {
value = TimeSpan.FromSeconds((double)result);
return true;
}
if (DateTimeOffset.TryParse(value2, out DateTimeOffset result2)) {
value = result2 - DateTimeOffset.Now;
return true;
}
}
value = default(TimeSpan);
return false;
}
}
}