Handle HTTPS from config

Change-Id: I48ea5ea2e35e62906b7b5ec5c5e624d06192172b
This commit is contained in:
Piotr Fus 2018-02-26 10:39:34 +01:00
parent 76a3ecacad
commit d070ea820b
2 changed files with 13 additions and 5 deletions

View file

@ -122,7 +122,7 @@ class HttpMockServer {
throw new RuntimeException('mock already registered')
}
Mock mock = mockFromConfig(co)
HttpServerWrapper child = getOrCreateChildServer(mock.port, null)
HttpServerWrapper child = getOrCreateChildServer(mock.port, mock.https)
child.addMock(mock)
configuration.put(name, co)
mockNames << name
@ -172,6 +172,16 @@ class HttpMockServer {
mock.responseHeaders = co.responseHeaders ?: null
mock.schema = co.schema ?: null
mock.preserveHistory = co.preserveHistory != false
if (co.https) {
mock.https = new Https(
keystorePath: co.https.keystorePath ?: null,
keystorePassword: co.https.keystorePassword,
keyPassword: co.https.keyPassword,
truststorePath: co.https.truststorePath,
truststorePassword: co.https.truststorePassword,
requireClientAuth: co.https?.requireClientAuth?.asBoolean() ?: false
)
}
return mock
}