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:
Stef Heyenrath
2019-12-26 13:57:35 +01:00
committed by GitHub
parent b5795713b1
commit 120a808104
17 changed files with 236 additions and 72 deletions

View File

@@ -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>