hi! what would be the way to verify a response con...
# pact-js
t
hi! what would be the way to verify a response contains HTML code? consumer test:
Copy code
willRespondWith: {
            status: 200,
            headers: { 'Content-Type': 'text/html; charset=utf-8' },
            body: somethingLike('<html>some content</html>')
        }
actual response from the provider is:
Copy code
<html>
        <head>
lots of stuff
</body>
      </html>
current error:
Copy code
Expected body '{"value":"<html></html>","pact:matcher:type":"type"}' to match '
      <html>
        <head>
lots of stuff
</body>
      </html>'
thank you!
m
hmmm probably lots of regex 😱 (or exact match)
You could consider creating an HTML content-type plugin (docs.pact.io/plugins)
t
that sounds complicated haha. Is there a way just to ensure the doc starts with
<html>
and ends with
</html>
?
m
yes - a regex should do that