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

Fix Xpath to get correct equals method #64

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

ashashev
Copy link
Contributor

Problem

One can create multiple equal stubs if body request prerequisite contains xpath.

Stub example:

{
  "path": "/alpha/test/request",
  "name": "request",
  "labels": [],
  "method": "POST",
  "scope": "persistent",
  "request": {
    "headers": {},
    "query": {},
    "body": {
      "/Envelope/Body/loadData/data/request[@optype='02']": {
        "exists": true
      }
    },
    "extractors": {},
    "inlineCData": true,
    "mode": "xpath"
  },
  "response": {
    "code": 200,
    "headers": {
      "Content-Type": "application/xml"
    },
    "body": "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body></soapenv:Body></soapenv:Envelope>",
    "delay": null,
    "mode": "xml"
  }
}

Solution

The problem is the equals method of XPathExpression return false for two equal instances. The solution is exclude the field toXPathExpr from the equals method of Xpath type.

@mockingbird/maintainers

@danslapman danslapman merged commit 3e966c2 into leviysoft:main Mar 27, 2024
7 checks passed
@ashashev ashashev deleted the fix/xpath-equals branch March 27, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants