Thank you for your response. Below are some examples of the request/response pairs in mappings:
{
"request" : {
"urlPattern" : "/product-web/effectiveproducts/12153537-3856-1000-1000-00000010\\?asofdate=2013-12-20",
"method" : "GET"
},
"response" : {
"status" : 200,
"bodyFileName" : "body-effectiveproducts-12153537-3856-1000-1000-00000010-8Niif.json",
"headers" : {
"Date" : "Tue, 29 Sep 2015 18:54:52 GMT",
"Access-Control-Allow-Origin" : "*",
"X-SourceOfRecord" : "false",
"X-StaleDataIndicator" : "false",
"Content-Type" : "application/vnd.vsp.effectiveproduct+json;version=2.1",
"Keep-Alive" : "timeout=5, max=94",
"Connection" : "Keep-Alive",
"Transfer-Encoding" : "chunked"
}
}
}
{
"request" : {
"urlPattern" : "/product-web/effectiveproducts/12153537-3856-1000-1000-00000010\\?asofdate=2013-06-18",
"method" : "GET"
},
"response" : {
"status" : 200,
"bodyFileName" : "body-effectiveproducts-12153537-3856-1000-1000-00000010-WatMY.json",
"headers" : {
"Date" : "Tue, 29 Sep 2015 18:54:49 GMT",
"Access-Control-Allow-Origin" : "*",
"X-SourceOfRecord" : "false",
"X-StaleDataIndicator" : "false",
"Content-Type" : "application/vnd.vsp.effectiveproduct+json;version=2.1",
"Keep-Alive" : "timeout=5, max=98",
"Connection" : "Keep-Alive",
"Transfer-Encoding" : "chunked"
}
}
}
{
"request" : {
"urlPattern" : "/product-web/effectiveproducts/12153537-3856-1000-1000-00000010\\?asofdate=.*",
"method" : "GET"
},
"response" : {
"status" : 200,
"bodyFileName" : "body-effectiveproducts-12153537-3856-1000-1000-00000010-OUXLJ.json",
"headers" : {
"Date" : "Tue, 29 Sep 2015 18:54:53 GMT",
"Access-Control-Allow-Origin" : "*",
"X-SourceOfRecord" : "false",
"X-StaleDataIndicator" : "false",
"Content-Type" : "application/vnd.vsp.effectiveproduct+json;version=2.1",
"Keep-Alive" : "timeout=5, max=92",
"Connection" : "Keep-Alive",
"Transfer-Encoding" : "chunked"
}
}
}
Initially I had:
wireMockServer.stubFor(get(urlMatching("/.*")).willReturn(aResponse().proxiedFrom(getRecordingTargetURL())));
because I had hundreds of URLs that varied in parameters. However, when all the parameters are the same, and the query parameter for the date varies, that's when I want to set priority. I tried regex, but I get an illegal argument exception:
wireMockServer.stubFor(get(urlMatching("/product-web/effectiveproducts/12153537-3856-1000-1000-00000010\\?asofdate=\\.\\*")).atPriority(5).willReturn(aResponse().proxiedFrom(getRecordingTargetURL())));
wireMockServer.stubFor(get(urlMatching("/product-web/effectiveproducts/12153537-3856-1000-1000-00000010\\?asofdate=.*")).atPriority(1).willReturn(aResponse().proxiedFrom(getRecordingTargetURL())));
But I would like to match the URLeven if the parameters in the middle (12153537-3856-1000-1000-00000010) vary without having to write a new URL matching for each URL if possible.