pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

Whitespace removed from header include validation

Open dianaDBB opened this issue 11 months ago • 8 comments

Pact JVM version (maven):

  • group-id = au.com.dius.pact.provider
  • artifact-id = junit5
  • version-id = 4.3.11

In consumer (Pact JS) I add an expected result with MatchersV3.includes that has a whitespace:

.willRespondWith({
    status: 200,
    headers: {
        'content-disposition': MatchersV3.includes('attachment; filename='),
    },
});

This generates a contract with the following (it has the whitespace):

"response": {
  "headers": {
    "content-disposition": "attachment; filename=",
  },
  "matchingRules": {
    "header": {
      "content-disposition": {
        "combine": "AND",
        "matchers": [
          {
            "match": "include",
            "value": "attachment; filename="
          }
        ]
      }
    }
  },
  "status": 200
}

However, when provider (Pact JVM) verifies this contract, it fails with the following error - the whitespace was removed from the expected result

"mismatches": [
  {
    "attribute": "header",
    "description": "Expected header 'content-disposition' to have value 'attachment;filename=' but was 'attachment; filename=SomeFileNameHere'",
    "identifier": "content-disposition"
  }
]

This test should pass, the whitespace should not be removed from the validation.

dianaDBB avatar Jul 26 '23 10:07 dianaDBB