mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-17 23:57:03 +01:00
Reworked code review comments
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user