mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-22 00:59:02 +01:00
DELETE /__admin/mappings/{guid}
This commit is contained in:
@@ -144,6 +144,22 @@ namespace WireMock.Server
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the mappings.
|
||||
/// </summary>
|
||||
public void DeleteMapping(Guid guid)
|
||||
{
|
||||
lock (((ICollection)_mappings).SyncRoot)
|
||||
{
|
||||
// Check a mapping exists with the same GUID, if so, remove it.
|
||||
var existingMapping = _mappings.FirstOrDefault(m => m.Guid == guid);
|
||||
if (existingMapping != null)
|
||||
{
|
||||
_mappings.Remove(existingMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search logs for.
|
||||
/// </summary>
|
||||
@@ -192,11 +208,7 @@ namespace WireMock.Server
|
||||
lock (((ICollection)_mappings).SyncRoot)
|
||||
{
|
||||
// Check a mapping exists with the same GUID, if so, remove it first.
|
||||
var existingMapping = _mappings.FirstOrDefault(m => m.Guid == mapping.Guid);
|
||||
if (existingMapping != null)
|
||||
{
|
||||
_mappings.Remove(existingMapping);
|
||||
}
|
||||
DeleteMapping(mapping.Guid);
|
||||
|
||||
_mappings.Add(mapping);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user