BREAKING: Disabling automatic response decompression #1259
ianbotsf
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
An upcoming release of the AWS SDK for Kotlin will disable the automatic decompression of response bodies when using the OkHttp engine.
Release date
This feature will ship with the v1.1.0 release planned for 3/19/2024.
What's changing
When using the default HTTP engine OkHttp, the underlying HTTP client will no longer automatically decompress response bodies when they are Gzip compressed. Previously OkHttp would transparently decompress response bodies when the
Content-Encoding: gzip
header was present. (See OkHttp's documentation on calls for more detail.) No other HTTP engine automatically decompresses response bodies.This may manifest when retrieving an object from S3 that was uploaded with a
Content-Encoding: gzip
header. For instance, if compressed and uncompressed data exist like this:And the compressed data is uploaded to S3:
Then the object may be retrieved with a
getObject
call:Before the change the
getObject
example prints:After the change the
getObject
example prints:How to migrate
If you are using the default OkHttp engine and do not want to decompress response bodies, then no change is necessary.
If you do want to decompress response bodies, you will need to update your code. Response bodies may be decompressed using JVM's
GZIPInputStream
and theByteStream.toInputStream()
extension function:To apply automatic decompression to multiple response bodies you may consider writing an interceptor.
Feedback
If you have any questions concerning this change, please feel free to engage with us in this discussion. If you encounter a bug with these changes, please file an issue.
Beta Was this translation helpful? Give feedback.
All reactions