How to validate an XML response using Pact

2019-07-14 20:54发布

问题:

I am using Pact framework to test the response from an API. The responses are in XML format.Shown below is a sample of the response in my pact file.

"response": {
                "status": 200,
                "headers": {
                    "Content-Type": "application/xml"
                },
                "body": "`<rows p1='525'><row><seq_region_id>1</seq_region_id></row></rows>`"
            }

while this works, when the XML response is large, it is difficult to include all of it in the "body" JSON key. Does Pact framework support XML responses, like it does for JSON? I would appreciate it if you could suggest a more suitable way to validate XML responses using Pact

回答1:

Sadly, you're out of luck as this functionality is not currently available. We might concentrate on more data types in the future, but as of yet, we have more important priorities to focus on. Cheers.



标签: xml pact