Closed tienvx closed 5 months ago
There are a few problems here:
The matching expression $['X-IMPROVED']
is not correct, it should be X-IMPROVED
. This is probably an issue in the processing of the intermediate JSON format.
It's displaying the wrong error message. The actual message from the matching engine is Mismatch with header 'X-IMPROVED': Unable to match 'like' using Values for value at index 0
. This is a bigger issue with the description generated by the verification process.
We're having the same problem, but with any matchers for headers.
Frameworks / Versions used: Consumer: Angular
Consumer-test (rough excerpt):
...
await provider.addInteraction({
uponReceiving: 'a request',
withRequest: {
method: 'GET',
path: `/api/v1/data`,
headers: {}
},
willRespondWith: {
status: 200,
headers: {
'Content-Type': string('application/example')
},
body: {'data': 'someData'}
}
} as InteractionObject);
...
generates (excerpt):
...
"interactions": [
{
"description": "a request",
"pending": false,
"request": {
"method": "GET",
"path": "/api/v1/data"
},
"response": {
"body": {
"data": "someData"
},
"headers": {
"Content-Type": [
"application/example"
]
},
"matchingRules": {
"header": {
"$['Content-Type'][0]": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
},
"type": "Synchronous/HTTP"
}
]
...
We tried different matchers (string, regex, like, providerState), but all lead to the same problem.
After changing the key manually to Content-Type
within the matchingRules, the provider-tests recognizes the matcher and passes.
Am i right that this is the same issue? Should i report this at another repo?
This is probably caused by #355
I would like to test this again on the version 0.4.12
, but this error preventing me:
Verifying a pact between matchersConsumer and matchersProvider
WARNING: Pact file has no interactions
This error doesn't happen on 0.4.11
.
It look like that this error not related to this issue. If so I will create new issue for it.
UPDATED: this is the issue https://github.com/pact-foundation/pact-reference/issues/359
We're having the same problem, but with any matchers for headers.
Frameworks / Versions used: Consumer: Angular
- @pact-foundation/pact: 12.1.2
- jest-pact: 0.11.0
Consumer-test (rough excerpt):
... await provider.addInteraction({ uponReceiving: 'a request', withRequest: { method: 'GET', path: `/api/v1/data`, headers: {} }, willRespondWith: { status: 200, headers: { 'Content-Type': string('application/example') }, body: {'data': 'someData'} } } as InteractionObject); ...
generates (excerpt):
... "interactions": [ { "description": "a request", "pending": false, "request": { "method": "GET", "path": "/api/v1/data" }, "response": { "body": { "data": "someData" }, "headers": { "Content-Type": [ "application/example" ] }, "matchingRules": { "header": { "$['Content-Type'][0]": { "combine": "AND", "matchers": [ { "match": "type" } ] } } }, "status": 200 }, "type": "Synchronous/HTTP" } ] ...
We tried different matchers (string, regex, like, providerState), but all lead to the same problem.
After changing the key manually to
Content-Type
within the matchingRules, the provider-tests recognizes the matcher and passes.Am i right that this is the same issue? Should i report this at another repo?
after updating pact-core my generated files are fine.
This specific issue (using values
matcher with header) still happen when I updated to 0.4.13
I'm trying to match header to contain multiple values using ffi call but it doesn't work as I expected. Let focus on
values
matcher first:FFI call:
Trimmed pact file:
Provider response's header (same problem in 2 cases):
Verifier logs (same log in 2 cases)
Expected: No mismatches for
X-IMPROVED
Actual: Weird message from provider's verifier, saying that 2 identical strings are not equal (similar message in both cases):
For more information:
X-IMPROVED
) https://github.com/tienvx/pact-php/commit/2993bcec74a21df847f483186fd0d1529a629908