fix: allow error deserializers to populate error response body #1180
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.
Currently, deserializer collectors read response body streams prior to attempting to deserialize them.
If there is a parsing error, such as when a JSON service front end layer (load balancer, CDN, etc) has an error and returns non-JSON, the raw text of this error is lost since the stream collector has read the stream.
For this PR, addressing such cases, if the error contains a field called
$responseBodyText
, it will be written over the response body's (consumed and therefore empty) stream, so the user can read the body text instead of only having an empty stream.It is up to the deserializer implementation to write the body text to this field.
Example: