mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* fix(dynamodb): attach X-Amz-Crc32 header to JSON protocol responses The AWS SDK for Go v2 DynamoDB client wraps every response body in a CRC32-verifying reader and emits "failed to close HTTP response body, this may affect connection reuse" on every call when the header is missing. Real AWS DynamoDB includes this header on all responses. Add it at the JSON protocol boundary (AwsJsonController) for both DynamoDB and DynamoDBStreams, using a new DynamoDbResponses helper that serializes the entity to bytes, computes the CRC32, and rebuilds the Response with the bytes + header. Error responses are wrapped as well to match real AWS behavior. The wrapping lives in AwsJsonController rather than DynamoDbJsonHandler because the handler is also invoked from CBOR, API Gateway proxy, and Step Functions task flows — those callers must keep the original ObjectNode entity. Add unit tests for DynamoDbResponses and an integration test that verifies the header is present and matches the CRC32 of the response body bytes on both success and error responses. * test(dynamodb): use explicit UTF-8 charset in DynamoDbResponsesTest Address Copilot review comment on floci-io/floci#347: ".getBytes()" uses the platform default charset, which can make the test (and the computed CRC32) vary across environments. The string is ASCII so the bytes are the same on any sensible platform, but being explicit about UTF-8 makes the determinism obvious and matches the rest of the codebase.