我有以下测试计划,其中包含/ auth / login调用,然后是另一个/ user / getmydata调用,需要登录调用设置的授权cookie
/ auth / login调用的输出显示返回了授权cookie
Response headers:
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Wed, 05 Apr 2017 18:53:49 GMT
Expires: 0
Pragma: no-cache
Server: nginx/1.10.1
Set-Cookie: Authorization=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI1OGU1MWU5Y2EwOWQyNDQxZTZiOTUyNDciLCJ0b2tlblR5cGUiOiJBQ0NFU1MiLCJ1c2VyU2VlZCI6IjEwN250aGUiLCJleHAiOjE0OTI2MjgwMjl9.CjsKvpkdiuWkhJcsfURV6DuKbp4jjqLGPZR26GizTdCu7XstRmS0WmLqwVRswUvfKcAI8bNjU5MqW6K2Z2PVfg
X-Application-Context: application:stg1-us-east-1:8080
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Length: 646
Connection: keep-alive
然而,下一个/ user / getmydata调用没有显示要在请求中传回的cookie,因此调用失败
GET https://somedomain.com/user/getmydata
GET data:
[no cookies]
Request Headers:
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Content-Length: 0
Host: somedomain.com
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_121)
调试日志显示:
2017/04/05 15:44:42 DEBUG - jmeter.protocol.http.control.HC4CookieHandler: Received Cookie: Authorization=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI1OGU1MWU5Y2EwOWQyNDQxZTZiOTUyNDciLCJ0b2tlblR5cGUiOiJBQ0NFU1MiLCJ1c2VyU2VlZCI6IjEwN250aGUiLCJleHAiOjE0OTI2MzEwODJ9.vCf2Pl2BddEBDmCIuHzcSuE-cDL5p3AXkQHYjD-XRuQZ-7xOh0wrSoAhKiWsg18cYyY-y2RqcMQLQ73z4C1W-Q From: https://api-stg1.somedomain.com/auth/login
2017/04/05 15:44:42 DEBUG - jmeter.protocol.http.control.CookieManager: Add cookie to store api-stg1.somedomain.com TRUE /auth FALSE 0 Authorization eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI1OGU1MWU5Y2EwOWQyNDQxZTZiOTUyNDciLCJ0b2tlblR5cGUiOiJBQ0NFU1MiLCJ1c2VyU2VlZCI6IjEwN250aGUiLCJleHAiOjE0OTI2MzEwODJ9.vCf2Pl2BddEBDmCIuHzcSuE-cDL5p3AXkQHYjD-XRuQZ-7xOh0wrSoAhKiWsg18cYyY-y2RqcMQLQ73z4C1W-Q
2017/04/05 15:44:42 DEBUG - jmeter.protocol.http.control.HC4CookieHandler: Found 0 cookies for https://api-stg1.somedomain.com/user/getmydata
我做错了什么?