0

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

top 需要额外提供哪些配置?

我有以下 json 配置

 {
  "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<<<\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

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

IE

将证书导入密钥库

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

1 回答 1

0

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

无论哪种情况,请务必注意http://wiremock.org/docs/https/底部的证书要求。

于 2020-09-03T17:27:37.940 回答