httpexpect icon indicating copy to clipboard operation
httpexpect copied to clipboard

Add XML support

Open ghost opened this issue 9 years ago • 3 comments

like WithForm/WithJSON

ghost avatar Jul 02 '16 14:07 ghost

If we're adding xml builder (WithXML), which is trivial, we should also add xml assertions, which is not so trivial.

We currently have assertions designed for JSON types (value, object, array, string, number, boolean, null). I guess they're not sufficient for XML. E.g., XML can't be decoded into map, so we can't use Object. Also, XML nodes has attributes, namespaces, etc.

I'm not familiar with XML and don't use it my projects, so I have no idea of practical design for XML assertions.

Another thought is that XML builder and XML assertions should be developed in parallel. It's possible that encoding/xml is not suitable as a backend for our XML assertions, so we probably don't want to use it for WithXML too.

As a result, I can't add WithXML right now (to avoid breaking compatibility later). I'm not closing this issue, since XML support seems to be eligible feature for httpexpect.

If you have any thoughts about XML assertions design/requirements, or probably examples of such assertions in other projects (maybe even not in Go?), please share. Pull requests are also welcome :)

/link #13

gavv avatar Jul 03 '16 17:07 gavv

+1

chyroc avatar Sep 12 '17 04:09 chyroc

+1 to: obj := httpexpect.NewResponse(httpexpect.NewAssertReporter(t), response).XML().Object()

bernardolm avatar Aug 13 '19 19:08 bernardolm