Forum Discussion

AlekseiKlimkin's avatar
AlekseiKlimkin
Occasional Contributor
8 years ago

How to get a parameter value from x-www-form-urlencoded request?

Hi Everyone,

I have a mock service with a response to a request with Content-Type application/x-www-form-urlencoded.

 

I.e. a request looks like the following:

param1=value1&param2=value2&guid={someGuid}

 

I need to get the value of my "guid" parameter in the MockResponse script.

How can I do that?

 

I've tried the following:

1. def request = mockRequest.getRequestContent();

String uid = request.guid

 

2. 

def request = mockRequest.getRequestContent();

String uid = request.get(guid)

 

in which case I get the error messages: 

  • Caused by: com.eviware.soapui.impl.wsdl.mock.DispatchException: java.lang.Exception: No such property: guid for class: String
  • Caused by: com.eviware.soapui.impl.wsdl.mock.DispatchException: java.lang.Exception: No such property: guid for class: Script4

 

Of course I can do that with a Java regex, but I think there should be an easier way.

 

Thanks in advance.