【发布时间】:2020-03-03 06:38:09
【问题描述】:
获取响应为“响应:tcp_error:发生通信错误:“操作超时”
"
来自 POSTMAN/Curl
curl -X POST \
http://IP:PORT/{endpoint} \
-H 'Accept: application/json' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 5' \
-H 'Content-Type: application/json' \
-H 'Host: IP:PORT' \
-H 'Postman-Token: 053670e6-44d4-4d03-96bf-ab1178b02d06,ffad205d-320a-4cd0-a63d-1687873fbf1d' \
-H 'User-Agent: PostmanRuntime/7.19.0' \
-H 'appkey: ACTUAL APP KEY' \
-H 'cache-control: no-cache' \
-d '{
}'
上述 API 的可靠代码
RestAssured.baseURI = “http://IP”;
RestAssured.port = port;
RestAssured.useRelaxedHTTPSValidation();
Response response = RestAssured.given()
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("appkey", “ACTUAL APPKEY”)
.when()
.get(“ENDPOINT”);
System.out.println("Response: " + response.asString());
【问题讨论】:
-
发布代码,你尝试了什么,向我们展示邮递员的请求。
-
Fenio,以 curl 形式更新了代码和邮递员请求详细信息
标签: rest automation rest-assured