SivEng Orn wrote:
I have 2 requests in my threadGroup after recording from Postman. One
is the head method for getting CSRF cookies. Second is for login.
image.png
Getting csrf-cookies request is success, but the login request fails
with 500 status internal server error. I checked the response header
of the login, it's missing one set-cookie: XSRF-TOKEN compared to the
postman. In postman both of my requests are successful. I don't know
why the login in JMeter is not working.
I also add the CookieManager.check.cookies=false and
CookieManager.save.cookies=true to User.properties.
I also tried to add ${COOKIE_XSRF-TOKEN} to my login header manager. I
also tried using regular expression to extract the XRSF-TOKEN from the
response header of csrf-cookie head method request and pass the value
to the login header manager. But none of them are working.
Here is my test plan. I'm using JMeter 5.6.2
image.png
Any suggestions?
1. I don't think HEAD
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD>
method will give you any cookies
2. I don't think this is how real browser will work
So try switching from HEAD to GET
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET> method
and most probably it will be enough (given your other configurations are
correct). If you want to mimic real browser's behaviour when it comes to
handling embedded resources
<https://www.blazemeter.com/blog/web-testing-jmeter> - just tick the
relevant boxes under "Advanced" tab of the HTTP Request
<https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request>
sampler.
Remember to restart JMeter after any properties change otherwise it
won't be applied.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
For additional commands, e-mail: user-h...@jmeter.apache.org