Close http exchange at the end of http handler

This commit is contained in:
Dominik Przybysz 2017-06-02 08:30:36 +02:00
parent ab2b3f9481
commit 5a3af95f0b
2 changed files with 48 additions and 18 deletions

View file

@ -1114,4 +1114,23 @@ class MockServerIntegrationTest extends Specification {
remoteMockServer.removeMock('testRest')?.size() == 0
}
def "should handle empty post"() {
expect:
remoteMockServer.addMock(new AddMock(
name: 'testRest',
path: 'testEndpoint',
port: 9999,
statusCode: 201,
soap: false
))
when:
HttpPost restPost = new HttpPost('http://localhost:9999/testEndpoint')
CloseableHttpResponse response = client.execute(restPost)
then:
response.statusLine.statusCode == 201
Util.consumeResponse(response)
expect:
remoteMockServer.removeMock('testRest')?.size() == 1
}
}