https://linen.dev logo
#general
Title
# general
c

Chien Dinh

01/19/2024, 9:43 PM
hey folks, need some help with trying to do a path regex match. I'm using the wiremock-captain plugin in js to talk to my wiremock servers and this is my iWireMockRequest const
Copy code
const request: IWireMockRequest = {
	method: 'GET',
	endpoint: '\/contests\/\d+-\d+\/entries\?page=1&page_size=100&user=22',
}

const response: IWireMockResponse = {
	status: 200,
	body: ***,
}

 const features: IWireMockFeatures = {
	requestEndpointFeature: EndpointFeature.UrlPattern,
}
when I try to register the above to my wiremock server, i see in my logs that its registering the regex as:
Copy code
{"request":{"method":"GET","urlPattern":"/contests/d+-d+/entries?page=1&page_size=100&user=22"}
in which the /d+-d+/ looks incorrect and its not doing the regex correctly. I've tried to use \\d+ instead of \d+ but instead of it showing up as
\d+
when registered, it shows up as
\\d+
so i'm at a loss as to the correct way to escape the regex
bump!
l

Lee Turner

01/22/2024, 6:18 PM
Hi, sorry but I have never used
wiremock-captain
and am not a js developer so don't have a huge amount of knowledge in this area. Not sure if other members of the community have. Does this seem to be an issue with how wiremock-captain is creating the mappings ? If so I was wondering if you would get a more targeted response if you raised an issue on the wiremock-captain github page - https://github.com/HBOCodeLabs/wiremock-captain
c

Chien Dinh

01/22/2024, 6:39 PM
Thanks Lee! I'll see if i can get more iformation there
2 Views