Skip to content

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

Closed
@svram25

Description

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

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions