如何使用Curl命令来测试接口HTTP是否启用了长连接的功能。偶得一命令记录之
curl \
-w "\nusing %{local_ip}:%{local_port} %{method} %{remote_ip}:%{remote_port}\n" --request GET \
--url http://httpbin.org/headers \
--header 'Content-Type: application/json' \
--data '{"N": 8}' \
--next \
-w "\nusing %{local_ip}:%{local_port} %{method} %{remote_ip}:%{remote_port}\n" --request GET \
--url http://httpbin.org/headers \
--header 'Content-Type: application/json' \
--data '{"N": 8}' \
--next \
-w "\nusing %{local_ip}:%{local_port} %{method} %{remote_ip}:%{remote_port}\n" --request GET \
--url http://httpbin.org/headers \
--header 'Content-Type: application/json' \
--data '{"N": 8}'
{
"headers": {
"Accept": "*/*",
"Content-Length": "8",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "curl/7.85.0",
"X-Amzn-Trace-Id": "Root=1-63a52ca9-5d0cbad02e0d159c38af96e5"
}
}
using 10.22.76.27:60506 GET 52.45.51.124:80
{
"headers": {
"Accept": "*/*",
"Content-Length": "8",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "curl/7.85.0",
"X-Amzn-Trace-Id": "Root=1-63a52ca9-69e5c3ee65d60eca0d169e91"
}
}
using 10.22.76.27:60506 GET 52.45.51.124:80
{
"headers": {
"Accept": "*/*",
"Content-Length": "8",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "curl/7.85.0",
"X-Amzn-Trace-Id": "Root=1-63a52caa-31db64a8358426fa1d0fe28a"
}
}
using 10.22.76.27:60506 GET 52.45.51.124:80