Suman g
Suman g

Reputation: 477

How to escape soapui variable pattern in the json request

I have a JSON request for my API it takes input string as a pattern ${some.input} which is equivalent to SoapUI properties expansion

request.json looks like:

{
    "config": {
        "logmsg": "${some.input}",
        "logfile": "kilores.log",
        "loglevel": "${#TestCase#api_name}"
    }
}

when I send an sopaui request the raw looks like

{
    "config": {
        "logmsg": "",
        "logfile": "kilores.log",
        "loglevel": "info"
    }
}

The issue here is that SoapUI assumes ${some.input} belongs to SoapUI properties expansion and needs to be evaluated. Actually ${some.input} is part of the API JSON request and should not get evaluated by SoapUI before sending it. How can I achieve this? I have other SoapUI variables (like ${#TestCase#api_name}) in the same request that must be evaluated but not that particular one that belongs to the actual request.

Upvotes: 2

Views: 1174

Answers (1)

Rao
Rao

Reputation: 21379

I believe it is little trivial one. As you pointed correctly, it was being treated by soapui as property expansion and that is the reason it is being sent as "logmsg" : ""

All you need to do is add an additional $. Hence your request should be as shown below:

{
    "config": {
        "logmsg": "$${some.input}",
        "logfile": "kilores.log",
        "loglevel": "${#TestCase#api_name}"
    }
}

Upvotes: 1

Related Questions