Check if the path is valid when using WithPath(...) (#1377)

This commit is contained in:
Stef Heyenrath authored and GitHub committed 2025-11-08 09:02:00 +01:00
1 parent dfeabf228e
commit 21601889e0
12 files changed
+82 -10

No files matched your search

@@ -1,6 +1,7 @@
// Copyright © WireMock.Net
using System;
using WireMock.Validators;
// ReSharper disable once CheckNamespace
namespace WireMock.Admin.Mappings;
@@ -94,9 +95,14 @@ public partial class RequestModelBuilder
}
/// <summary>
/// Set the Path.
/// Set the Path. Must start with a forward slash (/).
/// </summary>
public RequestModelBuilder WithPath(string value) => WithPath(() => value);
public RequestModelBuilder WithPath(string value)
{
PathValidator.ValidateAndThrow(value);
return WithPath(() => value);
}
/// <summary>
/// Set the Path.