Commit 4b79a30c 4b79a30c8e0b93e5dd4bbee3df54ef3ac36d49c1 by Christian Gerdes

Added PassIfNotFound to XPathExtractionRule

1 parent f255d578
......@@ -52,6 +52,11 @@ namespace WebTest.WebService.Plugin.Runtime
set { randomMatch = value; }
}
[DisplayName("Pass if not found")]
[Description("If set to true, this rule will pass the request even if no match is found.")]
[DefaultValue(false)]
public bool passIfNotFound { get; set; }
/// <summary>
/// The Extract method. The parameter e contains the Web test context.
/// </summary>
......@@ -62,11 +67,7 @@ namespace WebTest.WebService.Plugin.Runtime
try
{
ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType);
if (contentHandler == null)
{
return;
}
if (contentHandler != null) {
if (contentHandler.IsBinary)
{
contentHandler.MessageBytes = e.Response.BodyBytes;
......@@ -114,12 +115,14 @@ namespace WebTest.WebService.Plugin.Runtime
return;
}
}
}
catch (Exception ex)
{
e.Message = ex.Message;
}
e.Success = false;
e.Success = passIfNotFound;
e.Message += " (XPath not found)";
return;
}
}
......