-
Notifications
You must be signed in to change notification settings - Fork 184
Add content auto decoding for download()
#986
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #986 +/- ##
==========================================
- Coverage 82.53% 82.45% -0.09%
==========================================
Files 37 37
Lines 3040 3043 +3
==========================================
Hits 2509 2509
- Misses 531 534 +3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/download.jl
Outdated
@@ -121,6 +123,11 @@ function download(url::AbstractString, local_path=nothing, headers=Header[]; upd | |||
start_time = now() | |||
prev_time = now() | |||
|
|||
if header(resp, "Content-Encoding") == "gzip" | |||
stream = TranscodingStream(GzipDecompressor(), stream) # auto decoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be:
stream = TranscodingStream(GzipDecompressor(), stream) # auto decoding | |
stream = GzipDecompressorStream(stream) # auto decoding |
and then we don't need the explicit dependency on TranscodingStreams
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I fixed.
@@ -13,6 +13,7 @@ include(joinpath(dir, "resources/TestRequest.jl")) | |||
"chunking.jl", | |||
"utils.jl", | |||
"client.jl", | |||
"download.jl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this test file is missing.
if header(resp, "Content-Encoding") == "gzip" | ||
filename *= ".gz" | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto decoding is added, so I think ".gz" is not needed anymore. And this change is needed to pass "test/download.jl".
Thanks @AtsushiSakai! |
This PR adds content auto decoding function for
download()
using TranscodingStreams.jl to fix #889