Wiremock - 请求HTTPS时无法获得响应

问题描述 投票:0回答:1

我想模仿像https://jsonplaceholder.typicode.com这样的https服务。它的代理和Postman在8089端口发送。但是当我试图获得'https://jsonplaceholder.typicode.com/todos/1'的请求时

我正进入(状态;

2019-04-02 17:43:28.291 Opened Socket[addr=/127.0.0.1,port=65409,localport=8089]
2019-04-02 17:43:28.362 Incoming bytes: CONNECT jsonplaceholder.typicode.com:443 HTTP/1.1
cache-control: no-cache
User-Agent: PostmanRuntime/7.6.0
Accept: */*
host: jsonplaceholder.typicode.com:443
Connection: close


2019-04-02 17:43:28.363 Closed Socket[addr=/127.0.0.1,port=65409,localport=8089]
2019-04-02 17:43:28.365 Closed Socket[addr=/127.0.0.1,port=65409,localport=8089]

我的线索配置如下图所示;

Mac114361:wiremock-standalone berkay.kirmizioglu$ java -jar wiremock-standalone-2.22.0.jar --enable-browser-proxying --https-port=8089 --port=8080 --record-mappings --verbose=true --proxy-all="https://jsonplaceholder.typicode.com" --print-all-network-traffic
2019-04-02 17:43:22.692 Verbose logging enabled
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2019-04-02 17:43:23.483 Verbose logging enabled
2019-04-02 17:43:23.498 Verbose logging enabled
2019-04-02 17:43:23.541 Recording mappings to ./mappings
 /$$      /$$ /$$                     /$$      /$$                     /$$      
| $$  /$ | $$|__/                    | $$$    /$$$                    | $$      
| $$ /$$$| $$ /$$  /$$$$$$   /$$$$$$ | $$$$  /$$$$  /$$$$$$   /$$$$$$$| $$   /$$
| $$/$$ $$ $$| $$ /$$__  $$ /$$__  $$| $$ $$/$$ $$ /$$__  $$ /$$_____/| $$  /$$/
| $$$$_  $$$$| $$| $$  \__/| $$$$$$$$| $$  $$$| $$| $$  \ $$| $$      | $$$$$$/ 
| $$$/ \  $$$| $$| $$      | $$_____/| $$\  $ | $$| $$  | $$| $$      | $$_  $$ 
| $$/   \  $$| $$| $$      |  $$$$$$$| $$ \/  | $$|  $$$$$$/|  $$$$$$$| $$ \  $$
|__/     \__/|__/|__/       \_______/|__/     |__/ \______/  \_______/|__/  \__/

port:                         8080
https-port:                   8089
https-keystore:               jar:file:/Users/berkay.kirmizioglu/Documents/wiremock-standalone/wiremock-standalone-2.22.0.jar!/keystore
proxy-all:                    https://jsonplaceholder.typicode.com
preserve-host-header:         false
enable-browser-proxying:      true
disable-banner:               false
record-mappings:              true
match-headers:                []
no-request-journal:           false
verbose:                      true
https wiremock
1个回答
0
投票

建议在使用HTTPS / SSL时坚持端口443。首先,因为大多数HTTP实现在使用https://协议时都会默认使用它,但是因为浏览器或其他HTTP客户端可能不支持这样做。

在您的示例中,您连接到端口443 CONNECT jsonplaceholder.typicode.com:443但在端口8090上运行WireMock。更改请求或WireMock端口。

© www.soinside.com 2019 - 2024. All rights reserved.