This PR adds a Body trait to allow modelling of different API body implementations.
All APIs accept JSON bodies, except bulk, msearch, msearchtemplate and ML post data,
which accept newline delimited JSON (ndjson).
Provide implementations of Body for both json and ndjson. Serde library is not able
to serialize to ndjson because an impl cannot generalize for all Serialize impls. To be able
to serialize ndjson requires access to the buffer, allowing a Body impl to control how
it is written to the buffer.
This PR adds a
Body
trait to allow modelling of different API body implementations. All APIs accept JSON bodies, except bulk, msearch, msearchtemplate and ML post data, which accept newline delimited JSON (ndjson).Provide implementations of
Body
for both json and ndjson. Serde library is not able to serialize to ndjson because an impl cannot generalize for allSerialize
impls. To be able to serialize ndjson requires access to the buffer, allowing aBody
impl to control how it is written to the buffer.Closes #31