在http GET请求jmeter中传递cookie [英] Pass cookie in http GET request jmeter
问题描述
理想情况下,我的要求应该是这样的:
Ideally, my request should be like this:
/oauth2/v1/consent?OCIS_REQ=asdfakdsfjsdfkjdfkjkdf
其中"asdfakdsfjsdfkjdfkjkdf"是我的Cookie
Where "asdfakdsfjsdfkjdfkjkdf" is my Cookie
我将其传递为:
/oauth2/v1/consent?${COOKIE_OCIS_REQ}
但是我的"${COOKIE_OCIS_REQ}"
变量没有被cookie替换.
虽然我在Header Manager中设置了cookie并在jmeter.properties中启用了CookieManager.save.cookies = true并将其作为
传递给HTTP Header Manager
名称:Cookie
值:${COOKIE_OCIS_REQ}
But my "${COOKIE_OCIS_REQ}"
Variable is not getting replaced with the cookie.
Though I set the cookie in Header Manager and enabled CookieManager.save.cookies=true in jmeter.properties and passing it in HTTP Header Manager as
Name : Cookie
Value : ${COOKIE_OCIS_REQ}
请求就像这样: GET https://vkon.demo.internal.com:1111/oauth2/v1 /consent $ {COOKIE_OCIS_REQ}
The request is simply going like : GET https://vkon.demo.internal.com:1111/oauth2/v1/consent${COOKIE_OCIS_REQ}
Cookie数据:
asdfakdsfjsdfkjdfkjkdf
asdfakdsfjsdfkjdfkjkdf
为什么我的变量没有被替换?我真的受够了.
Why my Variable is not getting replaced ?? I'm really fed up with this.
我尝试在请求中传递一个参数,用户定义的变量,但也没有运气!
I tried passing it a parameter in request, User defined variable Also but no luck!!
推荐答案
首先,通过添加Debug Sampler
和View Results Tree
检查创建的所有Cookie variables
.
First, check what all Cookie variables
are created by adding Debug Sampler
and View Results Tree
.
然后运行测试,然后在查看结果树"中查看调试采样器"的结果,以检查保存的Cookie变量,如下所示:
Then run the test and look at the Debug Sampler result in View Results Tree to check the Cookie variables saved as follows:
从上图中可以清楚地看到,已经创建了COOKIE_NID
,并且可以使用${COOKIE_NID}
语法将其用于其他请求.
From the above image, it is clear that COOKIE_NID
is created and can be used in other requests using ${COOKIE_NID}
syntax.
这篇关于在http GET请求jmeter中传递cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!