用于https调用的Wiremock json存根



我想在wiremock中设置https调用作为json配置存根。

顶部需要提供哪些附加配置?

我有下面的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
}

以上完全适用于http,但不适用于https:

当更改为https时,我得到以下内容

[WARNING] Illegal character 0x16 in state=START for buffer HeapByteBuffer@35a693b9[p=1,l=262,c=8192,r=261]={x16<<<x03x01x01x01x01x00x00xFdx03x03x87xEbxEbx8b0xB7x14...x01x03x02x03x03x02x01x02x02x02x033tx00x00>>>ding: gzip, defla...x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00}
[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

我参考了这个答案,但不确定第一个答案中第二步的密码

将证书导入密钥库

keytool -import -trustcacerts -alias mock -file localhost.crt -keystore identity.jks

根据http://wiremock.org/docs/https/您需要配置CCD_ 5。这是在启动时完成的,而不是在运行时,因此您似乎无法使用JSON API。如果您正在运行Wiremock的独立版本,您可以通过指定环境变量https-port来提供端口,请查看http://wiremock.org/docs/running-standalone/为此。

在任何一种情况下,请确保注意http://wiremock.org/docs/https/.

相关内容

  • 没有找到相关文章

最新更新