mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-01 06:33:11 +02:00
StatusCode as string (#385)
* StatusCode as string * fix tests * fix test * ReplaceSingleNode * <!--<DelaySign>true</DelaySign>--> * Array * add test * Response_ProvideResponse_Handlebars_WithBodyAsJson_ResultAsHandlebarsString * net461 * . * fix * target frame * BodyAsJson * Response_ProvideResponse_WithStatusCode * fix build * fix test
This commit is contained in:
@@ -10,6 +10,26 @@ namespace WireMock.Util
|
||||
/// </summary>
|
||||
internal static class HttpStatusRangeParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the specified pattern is match.
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern. (Can be null, in that case it's allowed.)</param>
|
||||
/// <param name="httpStatusCode">The value.</param>
|
||||
/// <exception cref="ArgumentException"><paramref name="pattern"/> is invalid.</exception>
|
||||
public static bool IsMatch(string pattern, object httpStatusCode)
|
||||
{
|
||||
switch (httpStatusCode)
|
||||
{
|
||||
case int statusCodeAsInteger:
|
||||
return IsMatch(pattern, statusCodeAsInteger);
|
||||
|
||||
case string statusCodeAsString:
|
||||
return IsMatch(pattern, int.Parse(statusCodeAsString));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified pattern is match.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user