Fix: Only add _stream_param for binary/streaming payloads, not JSON #446
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.
Summary
This PR fixes a bug where the RestJSON template incorrectly adds
_stream_paramto ALL response classes that have apayloadproperty, even when those payloads contain JSON data (not binary streams). This causes JSON responses to be returned as unparsed strings instead of being properly deserialized.The Problem
The current template adds
_stream_paramwhenever a response shape has apayloadproperty:This affects services like Pinpoint, where
SendMessagesResponsehas a JSON payload but was incorrectly marked as a stream, causing the JSON to not be parsed.The Solution
Check if the payload member explicitly has
streaming == 1before adding_stream_param:Impact
Testing
Added test
t/99_stream_param_bug.tthat verifies:_stream_param(JSON)_stream_param(binary)All 11 tests pass with this fix.
Real-World Impact
This bug was discovered when AWS Pinpoint SMS sending failed after a Paws upgrade - the JSON response wasn't being parsed, breaking error handling and response processing logic.