How can I get different response for same endpoint

1,111 views
Skip to first unread message

Chetan Dewangan

unread,
Apr 8, 2016, 3:45:55 PM4/8/16
to wiremock-user
Hi,

I wanted to get different response for same endpoint for using various data sets, How will this be possible.

Thanks,
Chetan

Tom Akehurst

unread,
Apr 11, 2016, 10:05:22 AM4/11/16
to wiremock-user
According to what criteria do you want the response to vary?

Do you want it to change for multiple identical requests, or vary according to e.g. the request body?

Jhony Chávez Mendoza

unread,
May 13, 2016, 1:19:09 PM5/13/16
to wiremock-user
Hi, Tom.

My criteria is multiples request body in same enpoint, following the way of working of SOAP UI
Is possible?

thanks.

Tom Akehurst

unread,
May 15, 2016, 4:46:47 PM5/15/16
to wiremock-user
So just to clarify, you mean you'd like the same endpoint to return 2 different responses for 2 different request bodies?

If so I'd suggest configuring 2 different stubs that match on the request body with either equalToXml or matchesXPath.

Jhony Chávez Mendoza

unread,
May 16, 2016, 12:56:53 PM5/16/16
to wiremock-user
Please, can you send me an example for each case. 
Thanks

Tom Akehurst

unread,
May 16, 2016, 1:53:31 PM5/16/16
to wiremock-user
Examples of both here: http://wiremock.org/stubbing.html

Jhony Chávez Mendoza

unread,
May 16, 2016, 8:11:55 PM5/16/16
to wiremock-user
Thanks, everything was successful. 

Vinod Xavier

unread,
Jun 27, 2016, 8:22:29 PM6/27/16
to wiremock-user
Hi, 
  I have a requirement to get different responses for the same end point. But i dont have any attribute through which i can uniquely differ the request to match. we do have unique username and pssword in the request, but the encrypted values of these fields will be keep on changing based on the encryption algorithm we are using. Is there any alternative to this? We have almost around 20 request to be stubbed to verify our error scenarios.
Reply all
Reply to author
Forward
0 new messages