DELETE /__admin/requests/{guid}

This commit is contained in:
Stef Heyenrath
2017-01-30 14:28:17 +01:00
parent 7f790a5861
commit 9a413a0940
2 changed files with 46 additions and 8 deletions

View File

@@ -141,6 +141,27 @@ namespace WireMock.Server
}
}
/// <summary>
/// Deletes the mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
[PublicAPI]
public bool DeleteLogEntry(Guid guid)
{
lock (((ICollection)_logEntries).SyncRoot)
{
// Check a logentry exists with the same GUID, if so, remove it.
var existing = _logEntries.FirstOrDefault(m => m.Guid == guid);
if (existing != null)
{
_logEntries.Remove(existing);
return true;
}
return false;
}
}
/// <summary>
/// Resets the mappings.
/// </summary>
@@ -153,9 +174,11 @@ namespace WireMock.Server
}
/// <summary>
/// Resets the mappings.
/// Deletes the mapping.
/// </summary>
public void DeleteMapping(Guid guid)
/// <param name="guid">The unique identifier.</param>
[PublicAPI]
public bool DeleteMapping(Guid guid)
{
lock (((ICollection)_mappings).SyncRoot)
{
@@ -164,7 +187,10 @@ namespace WireMock.Server
if (existingMapping != null)
{
_mappings.Remove(existingMapping);
return true;
}
return false;
}
}