mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Fix gzip decompression with HTTP::Client
This commit is contained in:
parent
d379a36c0e
commit
b0f127d4d8
1 changed files with 9 additions and 2 deletions
|
@ -404,10 +404,17 @@ module YoutubeAPI
|
||||||
url = "#{endpoint}?key=#{client_config.api_key}"
|
url = "#{endpoint}?key=#{client_config.api_key}"
|
||||||
|
|
||||||
headers = HTTP::Headers{
|
headers = HTTP::Headers{
|
||||||
"Content-Type" => "application/json; charset=UTF-8",
|
"Content-Type" => "application/json; charset=UTF-8",
|
||||||
"Accept-Encoding" => "gzip",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The normal HTTP client automatically applies accept-encoding: gzip,
|
||||||
|
# and decompresses. However, explicitly applying it will remove this functionality.
|
||||||
|
#
|
||||||
|
# https://github.com/crystal-lang/crystal/issues/11252#issuecomment-929594741
|
||||||
|
{% unless flag?(:disable_quic) %}
|
||||||
|
headers["Accept-Encoding"] = "gzip"
|
||||||
|
{% end %}
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
|
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
|
||||||
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")
|
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")
|
||||||
|
|
Loading…
Reference in a new issue