Forum Discussion

sedge55's avatar
sedge55
New Contributor
11 years ago

Check whether Mock response exists

In a Mock Service operation the return statement identifies which Response is to be sent.
return "Transaction Not Supported"

If the value is held in a variable
def tran = ....

How can I check that the response identified in "tran" exists before attempting to send it?

Thanks
Steve

3 Replies

  • nmrao's avatar
    nmrao
    Community Hero
    Would you provide little more details of the problem? You mean to say you want to send the response using groovy script? Can you use like this? def trans = '''some foo more foo then bar''' if (trans) { return trans } else { return 'bar' }