Noel Rojas
04/11/2024, 6:44 PMregex
is a V3RegexMatcher and the consumer tests are all passing as expected.
The issue arises in the provider test where the html in the response is not tested against the provided regex and I keep getting the following error:
Expected body '{"pactmatchertype":"regex","regex":"<html>[\\\\s\\\\S]*?<head>[\\\\s\\\\S]*?<\\\\/head>[\\\\s\\\\S]*?<body>[\\\\s\\\\S]*?<\\\\/body>[\\\\s\\\\S]*?<\\\\/html>","value":"<html><head></head><body><h1>Hello, World!</h1></body></html>"}' to match ' <here goes the html document in the actual response> '
The question we have is: How can we test the content of a response that is not in JSON format, rather it is a string as in an HTML document?
I have tried with like
, somethingLike
, regex
, string
and it seems like none of them work for our purposes/needs.
Thank you for your time and help in advance.Praful Poudel
04/11/2024, 6:44 PMJoshua Ellis
04/11/2024, 11:09 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
rholshausen
04/12/2024, 1:15 AMrholshausen
04/12/2024, 1:16 AMMatt (pactflow.io / pact-js / pact-go)
rholshausen
04/12/2024, 2:01 AMJoshua Ellis
04/12/2024, 2:03 AM<html>
, and a couple of patterns to find some specific values within.Joshua Ellis
04/12/2024, 2:05 AM.
matches new lines or notMatt (pactflow.io / pact-js / pact-go)
rholshausen
04/12/2024, 5:41 AMMatt (pactflow.io / pact-js / pact-go)
rholshausen
04/12/2024, 6:24 AMMatt (pactflow.io / pact-js / pact-go)
Noel Rojas
04/12/2024, 3:09 PM^12.1.0
for both the consumer and provider. Also both consumer and provider are in TypeScript/JavaScript.Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Noel Rojas
04/15/2024, 2:49 PMMatt (pactflow.io / pact-js / pact-go)
Noel Rojas
04/16/2024, 3:19 PMNoel Rojas
04/16/2024, 3:20 PMMatt (pactflow.io / pact-js / pact-go)
rholshausen
04/17/2024, 12:01 AMMatt (pactflow.io / pact-js / pact-go)
rholshausen
04/17/2024, 12:06 AMMatt (pactflow.io / pact-js / pact-go)
contentType
matcher in IntegrationJSON.
Can this apply at any level? e.g. could you have a field that is base64 encoded and use this matcher?
Or does it only apply at the level of the entire response?rholshausen
04/17/2024, 12:11 AMrholshausen
04/17/2024, 12:12 AMJoshua Ellis
04/17/2024, 12:14 AMMatt (pactflow.io / pact-js / pact-go)
No, you have to use the FFI functions to set the matcher, you can’t use that form on non-JSONI’m not sure I follow this, sorry. Which FFI function?
Joshua Ellis
04/17/2024, 12:19 AMrholshausen
04/17/2024, 12:19 AMJoshua Ellis
04/17/2024, 12:20 AMwith_body
) which can detect JSON content and try and convert it to a matching ruleMatt (pactflow.io / pact-js / pact-go)