aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.58k stars 477 forks source link

Incorrectly using ASCII instead of UTF8 when converting message body to byte[] #1825

Closed normj closed 2 months ago

normj commented 2 months ago

Issue #, if available: https://github.com/aws/aws-lambda-dotnet/issues/1824

Description of changes: In a previous update to the library when we switched to using the registered serializer for deserializing message body to the FromBody type the code incorrectly converted to a byte array using the ASCII encoding. This PR changes the encoding to UTF8.

The changes is all in the APIGatewaySetupParameters.tt file. The rest of the PR is updating the version bump to 1.5.2 and updating the unit test snapshots.

Testing Updated the generated snapshots used in unit tests to confirm we are using UTF8. I also rerun the original issues scenario in Lambda with a built version of the NuGet package and confirmed the correct encoding of the Unicode characters.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.