Reputation: 2823
I wanted setup https
call as json configuration stub in wiremock.
What are the additional configuration need top provide?
I have below json config
{
"id": "177a103d-85e4-4688-acd6-acc8a97ce085",
"name": "provider_rest_push",
"request": {
"url": "/user/profile",
"method": "POST",
"bodyPatterns": [
{
"equalToJson": "{\"type\":\"011\".....}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
]
},
"response": {
"status": 200,
"body": "{\"result........."}",
"headers": {
"Cache-Control": "must-revalidate,no-cache,no-store",
"Content-Type": "application/json",
"Server": "Jetty(8.1.15.v20140411)"
}
},
"uuid": "177a103d-85e4-4688-acd6-acc8a97ce085",
"persistent": true,
"insertionIndex": 5
}
Above perfectly work for http
but NOT for https:
I get below when changed to https
[WARNING] Illegal character 0x16 in state=START for buffer HeapByteBuffer@35a693b9[p=1,l=262,c=8192,r=261]={\x16<<<\x03\x01\x01\x01\x01\x00\x00\xFd\x03\x03\x87\xEb\xEb\x8b0\xB7\x14...\x01\x03\x02\x03\x03\x02\x01\x02\x02\x02\x033t\x00\x00>>>ding: gzip, defla...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
[WARNING] badMessage: 400 Illegal character 0x16 for HttpChannelOverHttp@72ab37c7{r=0,c=false,a=IDLE,uri=-}
2020-03-17 12:53:14.631 Request received:
0:0:0:0:0:0:0:1 - POST /user/profile
I referred this answer but not sure the password for the second step in the first answer
i.e.
Import certification into keystore
keytool -import -trustcacerts -alias mock -file localhost.crt -keystore identity.jks
Upvotes: 0
Views: 2131
Reputation: 5108
According to http://wiremock.org/docs/https/ you need to configure the httpsPort
. This is done at startup, not at runtime so it seems that you can't use the JSON API for that. If you're running the standalone version of Wiremock you can provide the port by specifying the environment variable https-port
, have a look at http://wiremock.org/docs/running-standalone/ for that.
In either case, make sure you take note of the certificate requirements at the bottom of http://wiremock.org/docs/https/.
Upvotes: 0