mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-31 06:33:25 +02: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 JetBrains.Annotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using WireMock.Validation;
|
using WireMock.Validation;
|
||||||
|
|
||||||
@@ -47,11 +47,11 @@ namespace WireMock.Matchers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var jtoken = JToken.Parse(input);
|
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);
|
JToken jtoken = input is JToken token ? token : JObject.FromObject(input);
|
||||||
match = IsMatch(jtoken);
|
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;
|
using WireMock.Matchers;
|
||||||
|
|
||||||
namespace WireMock.RequestBuilders
|
namespace WireMock.RequestBuilders
|
||||||
@@ -56,6 +57,13 @@ namespace WireMock.RequestBuilders
|
|||||||
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
||||||
IRequestBuilder UsingAnyMethod();
|
IRequestBuilder UsingAnyMethod();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UsingAnyVerb: add HTTP Method matching on any method.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
||||||
|
[Obsolete]
|
||||||
|
IRequestBuilder UsingAnyVerb();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UsingMethod: add HTTP Method matching on any methods and matchBehaviour.
|
/// UsingMethod: add HTTP Method matching on any methods and matchBehaviour.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -70,5 +78,13 @@ namespace WireMock.RequestBuilders
|
|||||||
/// <param name="methods">The methods.</param>
|
/// <param name="methods">The methods.</param>
|
||||||
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
||||||
IRequestBuilder UsingMethod([NotNull] params string[] methods);
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="IMethodRequestBuilder.UsingAnyVerb"/>
|
||||||
|
public IRequestBuilder UsingAnyVerb()
|
||||||
|
{
|
||||||
|
return UsingAnyMethod();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(string[])"/>
|
/// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(string[])"/>
|
||||||
public IRequestBuilder UsingMethod(params string[] methods)
|
public IRequestBuilder UsingMethod(params string[] methods)
|
||||||
{
|
{
|
||||||
return UsingMethod(MatchBehaviour.AcceptOnMatch, 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[])"/>
|
/// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(MatchBehaviour, string[])"/>
|
||||||
public IRequestBuilder UsingMethod(MatchBehaviour matchBehaviour, params string[] methods)
|
public IRequestBuilder UsingMethod(MatchBehaviour matchBehaviour, params string[] methods)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user