akka-http-test
akka-http-test copied to clipboard
XML output from Marshaller
I think there might be a problem with the array marshaller. If you call the endpoint with "Accept: application/xml" , the XML response is syntactically correct, but the result is doubled. My guess would be replacing this:
Source.fromIterator(() ⇒ persons.iterator).mapAsync(1) { person ⇒
Marshal(persons.map(person ⇒ PersonV2(person.name, person.age, person.married))).to[NodeSeq]
}.map(ns ⇒ ByteString(ns.toString))
with this:
Source.fromIterator(() ⇒ persons.iterator).mapAsync(1) { person ⇒
Marshal(PersonV2(person.name, person.age, person.married)).to[NodeSeq]
}.map(ns ⇒ ByteString(ns.toString))
Basically I think you're going through the same iterator twice :)
Thanks for notifying me about this issue. I will look into it!