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

Decompress gzip files #2092

Merged
merged 2 commits into from Dec 13, 2015
Merged

Decompress gzip files #2092

merged 2 commits into from Dec 13, 2015

Conversation

Utsav2
Copy link
Contributor

@Utsav2 Utsav2 commented Dec 8, 2015

Update request lib.

This fixes #2090 and #1004, but I'm not sure how to unit test it.

I tried it with the example given in #1004

bower install --save-dev hellosign=http://s3.amazonaws.com/cdn.hellofax.com/js/embedded.js

and it works.

In short, if request notices a gzipped file, it decompresses it. We need to add the option there because request doesn't do it automatically (for backward compatibility reasons).

@0q98ahdsg3987y1h987y
Copy link

👍 Nice work!

@contolini
Copy link
Member

Nice job!

Some testing thoughts: Reply headers can be specified with nock. Try adding a test to test/util/download.js that mocks the downloading of a text file with a 'Content-Encoding': 'gzip' header. After it's downloaded, if you can successfully read its contents with fs.readFileSync, the test passes and satisfies #1004.

For #2090, use the same test as above but add .gz to the end of the text file.

If you need any help, find us on chat.

@Utsav2
Copy link
Contributor Author

Utsav2 commented Dec 9, 2015

@contolini Thanks for the tips. Just to clarify, I should add a gzipped file to tests/assets and test against that, right?

@sheerun
Copy link
Contributor

sheerun commented Dec 9, 2015

@Utsav2 Yes, you can use nock's "replyWithFile" helper and .txt file encoded with gzip you put in test/assets.

@Utsav2
Copy link
Contributor Author

Utsav2 commented Dec 13, 2015

@sheerun How does it look now?

@sheerun
Copy link
Contributor

sheerun commented Dec 13, 2015

LGTM :)

sheerun added a commit that referenced this pull request Dec 13, 2015
@sheerun sheerun merged commit 1e5122c into bower:master Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Gzipped files are producing empty folders or not getting extracted
5 participants