# How to escape session variable processing?

**URL:** <https://community.gatling.io/t/how-to-escape-session-variable-processing/2391>\
**Category:** Gatling (Open-Source)\
**Created:** [July 7, 2015, 7:58pm UTC](https://community.gatling.io/t/how-to-escape-session-variable-processing/2391 "2015-07-07T19:58:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Crews](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Christian\_Crews](https://community.gatling.io/u/Christian_Crews)\
**Post date:** [July 7, 2015, 7:58pm UTC](https://community.gatling.io/t/how-to-escape-session-variable-processing/2391/1 "2015-07-07T19:58:25Z")

</div>

I have a request that is like the following…

`

val bodyJson = “”"{“id”:“001”, “heading”:“Dear ${first\_name}”}"""

val httpRequest = http(“Some Request”)  
.post("/someservice")  
.header(“Authorization”, “${access\_token}”)  
.body(StringBody(bodyJson))  
.asJSON

`

I need “Dear ${first\_name}” to be literal. How do I escape the text “${first\_name}” so that it will not get processed as a session variable? I’ve tried various means of escaping special chars, but nothing’s working. My current work around is to set the following before executing the request, but that seems extremely janky AND adds an extra step to all of my chains.

`  
.exec(session =\> session.set(“first\_name”, “${first\_name}”))

`

Thanks,  
Christian

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [July 15, 2015, 8:19pm UTC](https://community.gatling.io/t/how-to-escape-session-variable-processing/2391/2 "2015-07-15T20:19:39Z")

</div>

We don’t currently have such escaping, sorry: you’re the first one to ever ask.  
Do you feel like contributing?

---

<div class="post-metadata">

**Author:** ![Christian\_Crews](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Christian\_Crews](https://community.gatling.io/u/Christian_Crews)\
**Post date:** [July 17, 2015, 7:41pm UTC](https://community.gatling.io/t/how-to-escape-session-variable-processing/2391/3 "2015-07-17T19:41:08Z")

</div>

I’m new to Scala and Gatling. I guess I could try. Where do I start?

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [July 17, 2015, 7:56pm UTC](https://community.gatling.io/t/how-to-escape-session-variable-processing/2391/4 "2015-07-17T19:56:39Z")

</div>

Here’s the compiler: [https://github.com/gatling/gatling/blob/master/gatling-core/src/main/scala/io/gatling/core/session/el/ElCompiler.scala](https://github.com/gatling/gatling/blob/master/gatling-core/src/main/scala/io/gatling/core/session/el/ElCompiler.scala)  
And here’s the spec where to add tests: [https://github.com/gatling/gatling/blob/master/gatling-core/src/test/scala/io/gatling/core/session/el/ElSpec.scala](https://github.com/gatling/gatling/blob/master/gatling-core/src/test/scala/io/gatling/core/session/el/ElSpec.scala)

This is non trivial: you have to be familiar with parsers, and then learn Scala [Parser Combinators](http://www.scala-lang.org/api/2.10.2/index.html#scala.util.parsing.combinator.Parsers).

Good luck 🙂
