Skip to content

Commit f5a6c40

Browse files
Fixes issue with controlling recording using proxy web API (#864)
1 parent 81274cd commit f5a6c40

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

dev-proxy/ApiControllers/ProxyController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ public IActionResult Set([FromBody] ProxyInfo proxyInfo)
2929

3030
if (proxyInfo.Recording.HasValue)
3131
{
32-
_proxyState.IsRecording = proxyInfo.Recording.Value;
32+
if (proxyInfo.Recording.Value)
33+
{
34+
_proxyState.StartRecording();
35+
}
36+
else
37+
{
38+
_proxyState.StopRecording();
39+
}
3340
}
3441

3542
return Ok(ProxyInfo.From(_proxyState));

dev-proxy/IProxyState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.DevProxy;
88
public interface IProxyState
99
{
1010
Dictionary<string, object> GlobalData { get; }
11-
bool IsRecording { get; set; }
11+
bool IsRecording { get; }
1212
IProxyConfiguration ProxyConfiguration { get; }
1313
List<RequestLog> RequestLogs { get; }
1414
void RaiseMockRequest();

dev-proxy/ProxyState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.DevProxy;
88

99
public class ProxyState : IProxyState
1010
{
11-
public bool IsRecording { get; set; } = false;
11+
public bool IsRecording { get; private set; } = false;
1212
public List<RequestLog> RequestLogs { get; } = [];
1313
public Dictionary<string, object> GlobalData { get; } = new() {
1414
{ ProxyUtils.ReportsKey, new Dictionary<string, object>() }

0 commit comments

Comments
 (0)