Passing cookies

Hi, All -

I’ve got a scenario that first does login operation and gets back Set-Cookie that I expect to be passed in futher requests but as far as I can see Gatling doesn’t add cookie in initPaymentRequest

val scn = scenario(“Init payment”)
.exec(registerUserRequest(user))
.exec(loginRequest(user))
.exec(initPaymentRequest(initPaymentParams)
.check(jsonCompare(expectedResponse, strict = false))
)

Maybe the scenario itself should be written some other way and that multiple exec cause the issue?

-yury

Hi,

Do you know what your Set-Cookie headers look like?

Thanks for the quick answer. Here it is:

Set-Cookie: tooe_token=0b1d81dd02d207491a6e9b0a2af9470da9eb1dad
Set-Cookie: tmp_time=1371731615

-yury

Mmm, that shouldn’t be a problem. Are you sure that Gatling doesn’t send anything? Or, might it send Cookies in a Version that your server doesn’t understand?
Could you please check this out: lower log level in logback.xml file.

Cheers,

Stéphane

Yes, I did. I enabled TRACE level for logging, so I can see all requests and response.

We used to use Gatling 1.4.2 and then I switched to 1.5.1 and it doesn’t work for both versions.

response was:
status=
200 OK
headers=
Set-Cookie: tooe_token=a307e787a8017dacf93914a5dddc0a7c7120864a

request was:
POST http://localhost:9888/v01/ru/payment
headers=
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:9888/v01/ru/login
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
Content-Length: 416

I found the way to solve the issue, I just added path="/" to the cookie and vu a la it just works :slight_smile:

Cool

I’ll investigate, still.

In upcoming 1.5.2, we’ve changed Cookie handling/parsing so we target latest RFC. Might fix your problem.

Cheers,

Stéphane

Thank you, Stéphane

I’ve added a test for cookies without path in both master and 1.5.X head and it passes fine, so your problem seem to be fixed with the RFC6265 support that’s coming with next 1.5.2.

Cheers,

Stéphane