Search code examples
restsoaprestful-urlwiremock

Wiremocking delete not happening


I am trying to mock a restful delete operation from a https soap service. the rest call is as follows

http://ixyz.elb.amazonaws.com/credit-cards/accounts/B2J1ofVLu%2B%25YTNU8%3D/payments/A%2BohlapfKazCWU8UuxF5I%2Fbf%2FhBFRHB%2B

I am using the following to stub the delete

stubFor(delete(urlPathMatching("/credit-cards/accounts/~/payments/~"))
                        .willReturn(aResponse()
                            .withStatus(200)));

The delete code is below its sample but the actual code is diff

HttpEntity <?> entity = new HttpEntity <>(new HttpHeaders());
new RestHelper().exchange(url, HttpMethod.DELETE, entity, String.class);

But the call is not getting stubbed with this. I tried using * instead of ~ but still not working. Any help will be appreciated.


Solution

  • You need .* for "any characters" rather than ~ in your path regex.