Reworked code review comments

This commit is contained in:
Stef Heyenrath
2018-05-12 12:45:58 +02:00
parent 9d6df1c7c8
commit d3640d065e
3 changed files with 36 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
using System;
using System.Linq;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using WireMock.Validation;
@@ -47,11 +47,11 @@ namespace WireMock.Matchers
try
{
var jtoken = JToken.Parse(input);
match = IsMatch(jtoken);
match = IsMatch(jtoken);
}
catch (Exception)
catch (JsonException)
{
// just ignore exception
// just ignore JsonException
}
}
@@ -70,9 +70,9 @@ namespace WireMock.Matchers
JToken jtoken = input is JToken token ? token : JObject.FromObject(input);
match = IsMatch(jtoken);
}
catch (Exception)
catch (JsonException)
{
// just ignore exception
// just ignore JsonException
}
}

View File

@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using System;
using JetBrains.Annotations;
using WireMock.Matchers;
namespace WireMock.RequestBuilders
@@ -56,6 +57,13 @@ namespace WireMock.RequestBuilders
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder UsingAnyMethod();
/// <summary>
/// UsingAnyVerb: add HTTP Method matching on any method.
/// </summary>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
[Obsolete]
IRequestBuilder UsingAnyVerb();
/// <summary>
/// UsingMethod: add HTTP Method matching on any methods and matchBehaviour.
/// </summary>
@@ -70,5 +78,13 @@ namespace WireMock.RequestBuilders
/// <param name="methods">The methods.</param>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder UsingMethod([NotNull] params string[] methods);
/// <summary>
/// UsingVerb: add HTTP Method matching on any methods.
/// </summary>
/// <param name="verbs">The methods.</param>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
[Obsolete]
IRequestBuilder UsingVerb([NotNull] params string[] verbs);
}
}

View File

@@ -207,12 +207,24 @@ namespace WireMock.RequestBuilders
return this;
}
/// <inheritdoc cref="IMethodRequestBuilder.UsingAnyVerb"/>
public IRequestBuilder UsingAnyVerb()
{
return UsingAnyMethod();
}
/// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(string[])"/>
public IRequestBuilder UsingMethod(params string[] methods)
{
return UsingMethod(MatchBehaviour.AcceptOnMatch, methods);
}
/// <inheritdoc cref="IMethodRequestBuilder.UsingVerb(string[])"/>
public IRequestBuilder UsingVerb(params string[] verbs)
{
return UsingMethod(verbs);
}
/// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(MatchBehaviour, string[])"/>
public IRequestBuilder UsingMethod(MatchBehaviour matchBehaviour, params string[] methods)
{