# How to disable gatling v3 built-in cookie handling?

**URL:** <https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831>\
**Category:** Gatling (Open-Source)\
**Created:** [February 20, 2019, 6:45pm UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831 "2019-02-20T18:45:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Sun](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jack\_Sun](https://community.gatling.io/u/Jack_Sun)\
**Post date:** [February 20, 2019, 6:45pm UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/1 "2019-02-20T18:45:14Z")

</div>

the built-in cookie handling is overwriting my special header named Cookie, and fail transaction the second repeat. First hit was fine though

thank you

---

<div class="post-metadata">

**Author:** ![Jack\_Sun](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jack\_Sun](https://community.gatling.io/u/Jack_Sun)\
**Post date:** [February 21, 2019, 12:54am UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/2 "2019-02-21T00:54:31Z")

</div>

…  
.repeat(2){  
exec(http(“resource”)  
.post("/resources")  
.headers(Map(“ **Cookie** ” **→ "qbn.ptc.gauthid=1075556084; qbn.ptc.parentid=50000000; qbn.ptc.authid=1075556084; qbn.ptc.agentid=1075556084"**  
.body(StringBody(s"""{“abc”}"""))  
.check(status.is(200))  
)  
…

---

<div class="post-metadata">

**Author:** ![Jack\_Sun](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jack\_Sun](https://community.gatling.io/u/Jack_Sun)\
**Post date:** [February 21, 2019, 12:58am UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/3 "2019-02-21T00:58:13Z")

</div>

here are request headers from 2 repeats. (first one works with correct customer Cookie, second one failed because customer Cookie not send at all

=====2. Bad

headers=

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0

cookie: ADRUM\_BTa=R:0|g:e85f5d5c-9bda-4bfe-a2d2-3f82adcf22aa|n:intuit-ss-dev\_3b662425-b849-4961-afd2-c0d77ddcf9d0; ADRUM\_BT1=R:0|i:46557; ADRUM\_BTs=R:0|s:f; apip=1075556084

origin: [https://developer](https://developer-e2e.api.intuit.com/)

host: developer

content-type: application/json

content-length: 10366

cookies=

ADRUM\_BTa=R:0|g:e85f5d5c-9bda-4bfe-a2d2-3f82adcf22aa|n:intuit-ss-dev\_3b662425-b849-4961-afd2-c0d77ddcf9d0, path=/, maxAge=30s

ADRUM\_BT1=R:0|i:46557, path=/, maxAge=30s

ADRUM\_BTs=R:0|s:f, path=/, maxAge=30s

apip=1075556084, path=/, maxAge=315360000s

======1st. Good

headers=

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0

Cookie: qbn.ptc.gauthid=1075556084; qbn.ptc.parentid=50000000; qbn.ptc.authid=1075556084;qbn.ptc.agentid=1075556084

accept: _/_

origin: [https://developer](https://developer-e2e.api.intuit.com/)

host: developer

content-type: application/json

content-length: 10366

---

<div class="post-metadata">

**Author:** ![G\_Madhana\_Mohana\_Red](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@G\_Madhana\_Mohana\_Red](https://community.gatling.io/u/G_Madhana_Mohana_Red)\
**Post date:** [February 22, 2019, 7:11am UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/4 "2019-02-22T07:11:36Z")

</div>

Add cookies the way mentioned bewlow. create object and call this steps in header for each request. You can set all cookies  
exec(addCookie(Cookie(“qbn.ptc.gauthid”,“1075556084”).withDomain(".yoursitename.com").withPath("/").withMaxAge(86400)))

---

<div class="post-metadata">

**Author:** ![Jack\_Sun](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jack\_Sun](https://community.gatling.io/u/Jack_Sun)\
**Post date:** [February 22, 2019, 6:33pm UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/5 "2019-02-22T18:33:38Z")

</div>

Thank you G Madhana Mohana Reddy:  
**Are you saying that in stead of class, i need to (format like) below: ?**

**object test{**  
**val scn1 =** scenario(“test cookie repeat”)  
.repeat(2) {  
.exec(http(“test”)  
.post(“target”)  
.exec(addCookie(Cookie(“qbn.ptc.gauthid”,“1075556084”).withDomain(".[yoursitename.com](http://yoursitename.com/)" ).withPath("/").withMaxAge(86400)))  
**}**  
**}**  
setup scn1.inject…

Jack

---

<div class="post-metadata">

**Author:** ![G\_Madhana\_Mohana\_Red](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@G\_Madhana\_Mohana\_Red](https://community.gatling.io/u/G_Madhana_Mohana_Red)\
**Post date:** [February 25, 2019, 5:17am UTC](https://community.gatling.io/t/how-to-disable-gatling-v3-built-in-cookie-handling/4831/6 "2019-02-25T05:17:48Z")

</div>

Yes Jack.
