canned icon indicating copy to clipboard operation
canned copied to clipboard

Wildcards not working for _someFile.get.json

Open schroepf opened this issue 9 years ago • 3 comments

I have a file called _userAccount.get.json living in some/path/any/another/path/_userAccount.get.json

I want this file to be returned as a JSON response when my client accesses http://localhost:3000/some/path/12345/another/path/userAccount but with canned 0.3.7 this doesn't work. Canned logs: request: get /some/path/12345/another/path/userAccount not found

If I move the file to some/path/any/another/path/userAccount/index.get.json and access http://localhost:3000/some/path/12345/another/path/userAccount/ from the client the expected JSON is returned.

So it seems like the any wildcard is working for index.get.json files, but not for _anyFileName.get.json files.

schroepf avatar Dec 08 '15 17:12 schroepf

That seems like a bug, thanks for reporting! If you have time to provide a testcase that would help a lot.

sideshowcoder avatar Dec 09 '15 10:12 sideshowcoder

When I added the test to canned.spec.js I noticed there is already a test case named 'loads named response from wildcard path for /d/1/bar' which tests this exact scenario - the only difference why this existing test passes and my test fails is that the existing test uses a number for the wildcard portion of the request url whereas my test uses characters - so maybe the issue only occurs if the client doesn't use a number in place of the wildcard

schroepf avatar Dec 09 '15 21:12 schroepf

That is indeed the case I think the regex matches for numbers, I think supporting characters would probably be good as well so.

sideshowcoder avatar Sep 09 '16 09:09 sideshowcoder