Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on gzipped JSON response #83

Open
mstetson opened this issue Sep 5, 2019 · 0 comments
Open

Error on gzipped JSON response #83

mstetson opened this issue Sep 5, 2019 · 0 comments

Comments

@mstetson
Copy link

mstetson commented Sep 5, 2019

AWSCore.jl automatically decodes certain response MIME types, but doesn't pay attention to the Content-Encoding header, so it fails when the data is compressed. Example:

using AWSS3

bucket = "SOMETHING-YOU-OWN"
s = """
    {"foo":"bar"}
    """
gz = open(`gzip`, "r+")
@async begin
    write(gz, s)
    close(gz.in)
end
zipped = read(gz)

s3_put(bucket, "test.json.gz", zipped, "application/json", "gzip")
s3_get(bucket, "test.json.gz")

Here, s3_get throws an error as JSON.jl attempts to parse the gzipped data. This happens in practice with AWS CloudTrail logs, for example.

JuliaWeb/HTTP.jl#256 suggests having the HTTP client handle this transparently, but I don't know whether that's the right solution or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant