Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathMatches in mock is not working properly in karate version 1.2.0 #2028

Closed
svram25 opened this issue May 25, 2022 · 6 comments
Closed

pathMatches in mock is not working properly in karate version 1.2.0 #2028

svram25 opened this issue May 25, 2022 · 6 comments
Assignees

Comments

@svram25
Copy link

svram25 commented May 25, 2022

Attached the below zip release with modified cats-mock.feature file which shows the issue.
Kindly use karate standalone jar 1.2.0.

karate-1.2.0.zip

Command used to run the mocks:
Run the below command from the place where karate jar is placed(jar location - karate-1.2.0\karate-1.2.0).
karate -p 8080 -m src/demo/mock/cats-mock.feature

Issue:
pathMatches in mock is ignoring the first character of the path added inside it. Please refer the below example.

Scenario: pathMatches('/cats') && methodIs('get')
* def response = { "mock" : "cats" }

If I hit http://localhost:8080/cats from postman, Karate is returning 404. Please refer the below screenshots.

image
image

If I hit http://localhost:8080/acats from postman, Karate is returning 200 and picking up the above mentioned mock. Please refer the below screenshots.

image
image

So it is picking up the incorrect mocks and since it is ignoring the first character path is not matched properly while using pathMatches.

Note: This functionality is working fine in 1.1.0

@ptrthomas
Copy link
Member

tagging as help wanted anyone is welcome to contribute a PR. we also haven't heard this from anyone else, so I don't consider it a priority.

again I'd like to remind everyone that this is why we release RC versions, to get this kind of feedback earlier instead of when it is too late.

@shaokunW-hotstar
Copy link

also found the same issue in 1.2.0

@ptrthomas ptrthomas self-assigned this May 27, 2022
@ptrthomas ptrthomas added this to the 1.3.0 milestone May 27, 2022
@ptrthomas
Copy link
Member

thanks @shaokunWang I investigated and found the problem. this only affects the "fatjar" users, so I've made a release only for that. can you confirm that the new version here works ? https://github.com/karatelabs/karate/releases/tag/v1.2.1.RC1

@svram25
Copy link
Author

svram25 commented May 27, 2022

@ptrthomas It is working fine now with Karate version v1.2.1.RC1

@shaokunW-hotstar
Copy link

@ptrthomas It is also working fine with Karate version v1.2.1.RC1 in my local machine.

ivangsa added a commit to ZenWave360/zenwave-apimock that referenced this issue May 27, 2022
@ptrthomas
Copy link
Member

1.3.0 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants