Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public async Task SetMatcher()

if (recordingId != null)
{
_recordingHandler.SetMatcherForRecording(recordingId, m);
await _recordingHandler.SetMatcherForRecording(recordingId, m);
}
else
{
Expand Down
11 changes: 9 additions & 2 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,14 +1093,21 @@ public void AddTransformToRecording(string recordingId, ResponseTransform transf
}


public void SetMatcherForRecording(string recordingId, RecordMatcher matcher)
public async Task SetMatcherForRecording(string recordingId, RecordMatcher matcher)
{
if (!PlaybackSessions.TryGetValue(recordingId, out var session))
{
throw new HttpException(HttpStatusCode.BadRequest, $"{recordingId} is not an active playback session. Check the value being passed and try again.");
}

session.CustomMatcher = matcher;
await session.Session.EntryLock.WaitAsync();
try {
session.CustomMatcher = matcher;
}
finally
{
session.Session.EntryLock.Release();
}
}

public async Task SetDefaultExtensions(string recordingId = null)
Expand Down
Loading