我找不到如何自动解析响应并在下一个 GET 请求中使用
###
POST http://localhost/coolsoftware/rest/authentication?login=username&password=1234
---- response will be
…
Set-Cookie: JSESSIONID=028EBF489BDF2D88A8A70935F4CA7C04; <-- I need this
…
###
GET http://localhost/coolsoftware/rest/bills/
Cookie: JSESSIONID=028EBF489BDF2D88A8A70935F4CA7C04; <-- to use here
Run Code Online (Sandbox Code Playgroud)
POST http://localhost/coolsoftware/rest/authentication?login=username&password=1234
> {% client.global.set("yourVariable", response.headers.valueOf('Set-Cookie')); %}
Run Code Online (Sandbox Code Playgroud)
进而:
GET http://localhost/coolsoftware/rest/bills/
Cookie: {{yourVariable}}
Run Code Online (Sandbox Code Playgroud)
如果有多个 Set-Cookie 标头,则应valuesOf()改为使用(在最新的 EAP 中可用),然后遍历分配变量的数组。
| 归档时间: |
|
| 查看次数: |
2332 次 |
| 最近记录: |