Skip to content

Commit

Permalink
add entry remove, call it
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Jul 26, 2024
1 parent 92b26ac commit 1e7a071
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
Expand Down Expand Up @@ -84,7 +84,7 @@ public void Record(RecordEntry entry)

public RecordEntry Lookup(RecordEntry requestEntry, RecordMatcher matcher, IEnumerable<RecordedTestSanitizer> sanitizers, bool remove = true)
{
foreach(RecordedTestSanitizer sanitizer in sanitizers)
foreach (RecordedTestSanitizer sanitizer in sanitizers)
{
sanitizer.Sanitize(requestEntry);
}
Expand All @@ -103,6 +103,14 @@ public RecordEntry Lookup(RecordEntry requestEntry, RecordMatcher matcher, IEnum
}
}

public void Remove(RecordEntry entry)
{
lock (Entries)
{
Entries.Remove(entry);
}
}

public void Sanitize(RecordedTestSanitizer sanitizer)
{
lock (Entries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming

if (remove)
{
session.Session.Lookup(entry, session.CustomMatcher ?? Matcher, sanitizers, remove: true);
session.Session.Remove(match);
}
}

Expand Down

0 comments on commit 1e7a071

Please sign in to comment.