Handle any method as mock request method

This commit is contained in:
Piotr Fus 2023-05-28 18:46:16 +02:00
parent 8ba339b8a0
commit 374947847d
4 changed files with 29 additions and 2 deletions

View file

@ -1152,4 +1152,30 @@ class MockServerIntegrationTest extends Specification {
'test/other' | 'test/other'
'/test/other' | 'test/other'
}
def 'should match any method'() {
given:
String name = "testRest-${UUID.randomUUID().toString()}"
remoteMockServer.addMock(new AddMock(
name: name,
path: 'any-method',
port: 9999,
statusCode: 201,
soap: false,
method: Method.ANY_METHOD
))
when:
CloseableHttpResponse response = client.execute(req)
then:
response.statusLine.statusCode == 201
Util.consumeResponse(response)
cleanup:
remoteMockServer.removeMock(name)
where:
req << [
new HttpGet('http://localhost:9999/any-method'),
new HttpPost('http://localhost:9999/any-method'),
new HttpPatch('http://localhost:9999/any-method')
]
}
}