Handle leading slash (#1)

* Handle leading slash
This commit is contained in:
piotrekfus91 2018-01-28 18:30:50 +01:00 committed by Dominik Przybysz
parent 6036bd2c3b
commit f8e0cc44f9
3 changed files with 40 additions and 1 deletions

View file

@ -1133,4 +1133,33 @@ class MockServerIntegrationTest extends Specification {
remoteMockServer.removeMock('testRest')?.size() == 1
}
@Unroll
def 'should handle leading slash'() {
given:
String name = "testRest-${UUID.randomUUID().toString()}"
expect:
remoteMockServer.addMock(new AddMock(
name: name,
path: mockPath,
port: 9999,
statusCode: 201,
soap: false
))
when:
HttpPost restPost = new HttpPost("http://localhost:9999/$urlPath")
CloseableHttpResponse response = client.execute(restPost)
then:
response.statusLine.statusCode == 201
Util.consumeResponse(response)
expect:
remoteMockServer.removeMock(name)?.size() == 1
where:
mockPath | urlPath
'' | ''
'/' | ''
'test' | 'test'
'/test' | 'test'
'test/other' | 'test/other'
'/test/other' | 'test/other'
}
}