Feature/deserialize off stream #534
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements deserializing straight of the response stream for those json serializers that allow for it.
This changes the low level usage pattern from
to
If
DesiredTypeis eitherstringorbyte[]the response will simply be read and will skip the deserializer altogether.A special
VoidResponsetype exists if you want to skip touching the response stream all together i.e when you only care about the http status code returned.When you do not have a
DesiredTypei.eresult.Responsewill be a dynamic that you can safely deeply nest on i.eThis wont throw runtime null binding ref exceptions even if for instance myproperty does not exists.
If you still need to hook into how the response stream turns into your desired
Tyou can subclass the default serializer and provide yours as current.new ElasticsearchClient(settings, serializer: mySubclassedSerializer)It can be handy in debug mode to always hold a copy of the response body on your
ElasticsearchResponseobject for this a new connection configuration toggle is introduced:now
response.ResponseRawwill hold abyte[]copy of the response.Fixes #522 ping @synhershko