For some reason a variable with a /
character get converted to a \/
, how do I prevent this?
- I start a echo server that listens on localhost:3000 by running
npx http-echo-server
- I execute the following:
code:
* def CHALLENGE_USER = '/abc/user'
* def loginJson = { user: '#(CHALLENGE_USER)' , name: 'Some Name'}
* print loginJson
* def TEST_URL = 'http://localhost:3000'
Given url TEST_URL+'/session/loginresponse'
And header Content-Type = 'application/json'
And request loginResponseJson
And method put
Then status 200
It prints { "user": "/abc/user", "name": "Some Name" }
like I expect.
The http server logs show "--> {"user":"/schemes/ATT_5_55/CH_1","name":"Some Name"}"
Karate shows the result of the echo
{"user":"\/abc\/user","name":"Some Name"}
I have tried:
- def CHALLENGE_USER = '/abc/user'
- def CHALLENGE_USER = "/abc/user"
- def CHALLENGE_USER = '/abc/user'
- def CHALLENGE_USER = '//abc//user'
also setting the variable after the fact does not work:
* def loginJson = { name: 'Some Name'}
* loginJson.user = CHALLENGE_USER