perf(transport): improve body encoding
perf(transport): improve body encoding

While enabling GZIP encoding for POST/PUT requests in previous commits,
we discovered that every JSON request body was serialized in memory
using `json.Marshal` instead of going through a `json.Encoder`, hence
avoiding to load the full content in memory.

This commit is fixing this issue by using an intermediate `json.Encoder`
to prevent in-memory loading of the content. This approach is still
compatible with the GZIP feature which was recently implemented as the
`json.Encoder` is simply the input of the `gzip.Writer` in that case.
This ensure everything is still buffered.

[changelog]

Do not serialize request bodies in-memory (use json.Encoder instead)

l4u/algoliasearch-client-go,algolia/algoliasearch-client-go,l4u/algoliasearch-client-go,algolia/algoliasearch-client-go