decode

fun decode(body: ByteArray, spec: DecisionSpec, serviceName: String, provenance: Function<String?, ModelProvenance>): DecisionResponse

Reads a response body into a decision response for the spec that was asked.

Return

one answer per question in spec order

Parameters

body

the response body

spec

the spec the request was encoded from

serviceName

the answering service's name, used in the anomaly log line

provenance

builds the provenance from the model the response names, or from null when it names none

Throws

if the envelope can't be read