Question - when I’m building my consumer contract ...
# pact-jvm
e
Question - when I’m building my consumer contract test I specify a json body in an HTTP
POST
operation. The actual json that gets sent has some extra fields in it that the server shouldn’t care about, but the mock server does not match it (I’m getting a
PartialRequestMatch
). Is there a way I can tell the request body matcher to allow extra keys in the json?
m
Just include them and let the provider deal with it. If the server ignores them then no problem, if it causes an issue then you've found a bug. If you really don't need them there, I guess you could post process the JSON and remove them?
But to my knowledge, I don't think such a thing exists
b
also, the mock should be matching on method & path & query—not body
e
what i’m saying though is that it does not match
if i send extra fields in the request the matcher does not match and the test fails
b
By default, it does allow extra fields. Maybe can you paste the test code, so we can see what might be wrong?
👌 1
m
Are you sending extra fields, but not specifying those extra fields in the test? If so, that will cause a consumer test failure, yes. If you could share the test/setup that would definitely help
🤔 1