Closed korayal closed 1 year ago
Can you please add an entry to lib/amazonka/CHANGELOG.md, which is the master changelog for the project?
I've updated the changelog and added a section Unreleased
at the top. would that work?
Also, are we sure that this is the correct check to make? What if the user's terminal is set to some other encoding scheme? A TextEncoding (as returned by System.IO.hGetEncoding) isn't even in Eq, so I'm not sure what the best way is to fix this. I suspect what we have here might be a bit too naive; do you have any thoughts about other ways we could check this? It may also be the case that we successfully decode UTF-8 but it's got non-printable characters in it; do we want to do that check here too?
I've added another check with isPrint
, where it should ensure that whatever we're trying to print contains printable characters. At this point I think assuming "the request body (if not compressed) is a valid utf-8 text" should be fine since it's what we're sending to AWS. The part that prints it out is still left to Build.lazyByteString
/ Build.byteString
, so at worst case we're keeping the existing behavior.
In the medium term, I probably want to extract logging from the main amazonka library so that people can use whatever logging framework suits them. Then handling non-printable stuff becomes the log library's concern.
that'd be great.
@endgame are we OK with the latest state of this PR?
closes #947
on my local tests targeting localstack, below are the results when I hit the
PutMetricData
endpoint via a gzipped wrapperor, when the data is printable (no gzipped payload):