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

$.download() doesn't decode file content (encoded with Brotli) #1755

Closed
asolntsev opened this issue Mar 17, 2022 · 0 comments · Fixed by #1756
Closed

$.download() doesn't decode file content (encoded with Brotli) #1755

asolntsev opened this issue Mar 17, 2022 · 0 comments · Fixed by #1756

Comments

@asolntsev
Copy link
Member

asolntsev commented Mar 17, 2022

The problem

I want to download file using PROXY method:

File textReport = $.download(using(PROXY));

But the downloaded file contains some binary characters. It's not a plain text file.

Details

Sometimes server might decide to encode the file content (using "Gzip", "compress", "deflate" or "br" method).
In this case Selenide doesn't decode the file content.

I personally experience this problem with "content-encoding": "br". Not sure if other encodings cause some problems.

Solution

I see two possible solutions.

  1. Implement decoding of all possible encoding methods: "Gzip", "compress", "deflate", "br". It should not be too hard.
  2. Add another request interceptor which overrides Accept-Encoding header before the download request:
request.headers().set("Accept-Encoding", "identity")

Then server should not encode the file content.

Tell us about your environment

  • Selenide Version: 6.3.4
@asolntsev asolntsev self-assigned this Mar 17, 2022
@asolntsev asolntsev added this to the 6.3.5 milestone Mar 17, 2022
asolntsev added a commit that referenced this issue Mar 17, 2022
this code logged all headers of all http responses in separate log lines. It's not needed in 99% cases.
@asolntsev asolntsev linked a pull request Mar 17, 2022 that will close this issue
asolntsev added a commit that referenced this issue Mar 17, 2022
this code logged all headers of all http responses in separate log lines. It's not needed in 99% cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant