-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MatcherMapper : Always use Pattern (#716)
- Loading branch information
Showing
5 changed files
with
143 additions
and
92 deletions.
There are no files selected for viewing
25 changes: 18 additions & 7 deletions
25
...ples/WireMock.Net.Console.NET5/__admin/mappings/11111110-a633-40e8-a244-5cb80bc0ab66.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
{ | ||
{ | ||
"Request": { | ||
"Path": { | ||
"Matchers": [ | ||
{ | ||
"Name": "WildcardMatcher", | ||
"Pattern": "/static/mapping" | ||
"Patterns": [ "/static/mapping", "/static/mapping2" ] | ||
} | ||
] | ||
}, | ||
"Body": { | ||
"Matcher": { | ||
"Name": "JsonMatcher", | ||
"Pattern": { | ||
"post1": "value 1", | ||
"post2": "value 2" | ||
}, | ||
"IgnoreCase": true | ||
} | ||
}, | ||
"Methods": [ | ||
"get" | ||
"get", | ||
"post" | ||
] | ||
}, | ||
"Response": { | ||
"BodyAsJson": { "body": "static mapping" }, | ||
"Headers": { | ||
"Content-Type": "application/json", | ||
"Test-X": [ "test 1", "test 2" ] | ||
} | ||
"Headers": { | ||
"Content-Type": "application/json", | ||
"Test-X": [ "test 1", "test 2" ] | ||
} | ||
} | ||
} |
154 changes: 77 additions & 77 deletions
154
src/WireMock.Net/RequestBuilders/IBodyRequestBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,80 @@ | ||
using JetBrains.Annotations; | ||
using System; | ||
using WireMock.Matchers; | ||
using WireMock.Matchers.Request; | ||
using JetBrains.Annotations; | ||
using System; | ||
using WireMock.Matchers; | ||
using WireMock.Matchers.Request; | ||
using WireMock.Util; | ||
|
||
namespace WireMock.RequestBuilders | ||
{ | ||
/// <summary> | ||
/// The BodyRequestBuilder interface. | ||
/// </summary> | ||
public interface IBodyRequestBuilder : IRequestMatcher | ||
{ | ||
/// <summary> | ||
/// WithBody: IMatcher | ||
/// </summary> | ||
/// <param name="matcher">The matcher.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] IMatcher matcher); | ||
|
||
/// <summary> | ||
/// WithBody: IMatcher[] | ||
/// </summary> | ||
/// <param name="matchers">The matchers.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] IMatcher[] matchers); | ||
|
||
/// <summary> | ||
/// WithBody: Body as string | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(string body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: Body as byte[] | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(byte[] body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: Body as object | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(object body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: func (string) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<string, bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (byte[]) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<byte[], bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (json object) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<object, bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (BodyData object) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<IBodyData, bool> func); | ||
} | ||
namespace WireMock.RequestBuilders | ||
{ | ||
/// <summary> | ||
/// The BodyRequestBuilder interface. | ||
/// </summary> | ||
public interface IBodyRequestBuilder : IRequestMatcher | ||
{ | ||
/// <summary> | ||
/// WithBody: IMatcher | ||
/// </summary> | ||
/// <param name="matcher">The matcher.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] IMatcher matcher); | ||
|
||
/// <summary> | ||
/// WithBody: IMatcher[] | ||
/// </summary> | ||
/// <param name="matchers">The matchers.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] IMatcher[] matchers); | ||
|
||
/// <summary> | ||
/// WithBody: Body as string | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(string body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: Body as byte[] | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(byte[] body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: Body as object | ||
/// </summary> | ||
/// <param name="body">The body.</param> | ||
/// <param name="matchBehaviour">The match behaviour.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody(object body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch); | ||
|
||
/// <summary> | ||
/// WithBody: func (string) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<string, bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (byte[]) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<byte[], bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (json object) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<object, bool> func); | ||
|
||
/// <summary> | ||
/// WithBody: func (BodyData object) | ||
/// </summary> | ||
/// <param name="func">The function.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
IRequestBuilder WithBody([NotNull] Func<IBodyData, bool> func); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters