Files
WireMock.Net/test/WireMock.Net.Tests/MappingBuilderTests.ToCSharpCode_Server.verified.txt
Stef Heyenrath 3353be65b5 Add FormUrlEncodedMatcher (#1147)
* FormUrlEncodedMatcher

* .

* Fix

* new

* support wildcard
2024-07-27 14:40:23 +02:00

59 lines
1.4 KiB
Plaintext

var server = WireMockServer.Start();
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("/foo")
.WithParam("test", "it.Length < 10")
)
.WithGuid("41372914-1838-4c67-916b-b9aacdd096ce")
.RespondWith(Response.Create()
.WithBody("{ msg: \"Hello world!\"}")
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post2")
.WithBody(new JsonMatcher(
value: new
{
city = "Amsterdam",
country = "The Netherlands"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931002")
.RespondWith(Response.Create()
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/form-urlencoded")
.WithHeader("Content-Type", "application/x-www-form-urlencoded", true)
.WithBody("name=John Doe")
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931003")
.RespondWith(Response.Create()
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post1")
.WithBody(new JsonMatcher(
value: new
{
Request = "Hello?"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931001")
.RespondWith(Response.Create()
);