-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathResourcesRecordMatcher.cs
31 lines (27 loc) · 1.21 KB
/
ResourcesRecordMatcher.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections.Generic;
using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
{
public class ResourcesRecordMatcher : PermissiveRecordMatcherWithApiExclusion
{
public ResourcesRecordMatcher(bool ignoreResourcesClient, Dictionary<string, string> providers) : base(ignoreResourcesClient, providers)
{
}
public ResourcesRecordMatcher(bool ignoreResourcesClient, Dictionary<string, string> providers, Dictionary<string, string> userAgents)
: base(ignoreResourcesClient, providers, userAgents)
{
}
private const string RetryAfterHeader = "Retry-After";
private static readonly List<string> RetryAfterValue = new List<string> {"0"};
public override string GetMatchingKey(RecordEntry recordEntry)
{
if (recordEntry.ResponseHeaders.ContainsKey(RetryAfterHeader))
{
recordEntry.ResponseHeaders.Remove(RetryAfterHeader);
}
recordEntry.ResponseHeaders.Add(RetryAfterHeader, RetryAfterValue);
return base.GetMatchingKey(recordEntry);
}
}
}