pub(crate) fn decode<R: Message + Default>(
headers: &HeaderMap,
body: Bytes,
max: usize,
from_json: fn(&Yaml) -> Result<R, String>,
) -> Result<(bool, R), (bool, StatusCode, String)>Expand description
An error in the encoding the client asked for.
OTLP wants a google.rpc.Status; for the JSON case that is a two-field
object, and hand-writing it costs less than a serializer. The protobuf case
keeps returning text — encoding a Status there means another generated type
for a path no exporter parses.
Content type, then content encoding, then the wire format. The bool is
“the client speaks JSON”, which every answer to it has to be written in.
Split out of export for proxy, which decodes the same three request
types in order to split them by entity and forward the parts. One copy of
the header handling, so a gzip or content-type rule fixed on one path is
fixed on both.