# Unique header value for every Request

**URL:** <https://community.gatling.io/t/unique-header-value-for-every-request/4099>\
**Category:** Gatling (Open-Source)\
**Created:** [December 26, 2017, 5:33am UTC](https://community.gatling.io/t/unique-header-value-for-every-request/4099 "2017-12-26T05:33:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rejy\_v](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Rejy\_v](https://community.gatling.io/u/Rejy_v)\
**Post date:** [December 26, 2017, 5:33am UTC](https://community.gatling.io/t/unique-header-value-for-every-request/4099/1 "2017-12-26T05:33:09Z")

</div>

Hi,

I have trouble generating unique header value for a specific key for every single user request. Below is the code I am attempting , however the “x-hey” header value is always the same value

object TestCreateScenario {

val scn = scenario(“Payment Post”)  
.exec(  
http(“request\_3”)  
.post(“[http://localhost:8000/api/pyme](http://localhost:8000/api/pyme)”)  
.header(“x-key”, session =\> getXKey())  
.header(“Content-Type”, “application/json”)  
.body(StringBody(GenerateData.generate())).asJSON  
.check(status.is(200))  
)

def getXKey() : String = {  
UUID.randomUUID().toString()  
}  
}

I want to generate diff value for “x-Key” header for each request.

Appreciate your help

Thanks,  
-Rejy

---

<div class="post-metadata">

**Author:** ![Rejy\_v](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Rejy\_v](https://community.gatling.io/u/Rejy_v)\
**Post date:** [December 26, 2017, 6:33am UTC](https://community.gatling.io/t/unique-header-value-for-every-request/4099/2 "2017-12-26T06:33:30Z")

</div>

Sorry , it was my bad. I have added a different header element elsewhere which caused the issue. Its working fine now.

Thanks,  
-Rejy
