how to write contract for an API having html conte...
# pact-jvm
p
how to write contract for an API having html content as response. I can verify response header content type is text/html. But does it even make sense to verify the body contains html content, if so how do I write contract in a more general way (may be I would have to check <html and /html> tags exist)
m
You can check it, but we don't have matches for HTML so you'd need to check the exact contents
u
You can use the content type matcher. It will check that the body contains a valid HTML header
m
for clarity, are you suggesting to just match the content type (header) but ignore the body? (I’d not want to match on an HTTML body with exact contents)
we don’t support regex or anything on non-JSON bodies do we Ron?
u
No, Pact-JVM supports the content type matcher, which will check the header (the first 20 bytes) of the body. Not the content type header.
m
ohh, cool
is there a similar matcher in Rust?
u
Yes
It is the same matcher that is used for binary payloads
👍 1