File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 22
33# 测试微服务认证流程脚本
44
5- # 等待服务启动
6- echo " 等待服务启动..."
7- sleep 20
5+ echo " 开始测试..."
86
97# 定义变量
10- auth_service_url=" http://localhost:8000 /api/auth"
11- user_service_url=" http://localhost:8001 /api/users"
12- product_service_url=" http://localhost:8002 /api/products"
13- username=" testuser "
14- password=" testpassword "
8+ auth_service_url=" http://localhost/api/auth"
9+ user_service_url=" http://localhost/api/users"
10+ product_service_url=" http://localhost/api/products"
11+ username=" admin "
12+ password=" secret "
1513
1614# 1. 测试登录获取token
1715echo -e " \n1. 测试登录获取token..."
18- login_response=$( curl -s -X POST " ${auth_service_url} /login " -H " Content-Type: application/json " -d ' { "username": " ' ${username} ' ", " password": " ' ${password} ' "} ' )
16+ login_response=$( curl -s -X POST " ${auth_service_url} /token " -H " Content-Type: application/x-www-form-urlencoded " -d " username= ${username} & password= ${password} " )
1917
2018token=$( echo " ${login_response} " | grep -o ' "access_token":"[^"]*' | cut -d' :' -f2 | tr -d ' "' )
2119
You can’t perform that action at this time.
0 commit comments