mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-11 01:26:37 +00:00
fix(http): drop APIHelper's hand-set brotli encoding; LogoHelper sends the real UA
APIHelper advertised `br` though brotli isn't installed, so a server that honoured it would send a body requests can't decode. LogoHelper sent a bare `LEDMatrix-Common/1.0`, the kind of User-Agent ESPN has been rejecting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,13 @@ class TestSharedHeaders:
|
||||
def test_api_helper_sends_the_same_user_agent(self):
|
||||
assert APIHelper().session.headers['User-Agent'] == USER_AGENT
|
||||
|
||||
def test_api_helper_does_not_hand_set_brotli(self):
|
||||
assert 'br' not in APIHelper().session.headers.get('Accept-Encoding', '')
|
||||
|
||||
def test_logo_helper_sends_the_same_user_agent(self):
|
||||
from src.common.logo_helper import LogoHelper
|
||||
assert LogoHelper(display_width=64, display_height=32).session.headers['User-Agent'] == USER_AGENT
|
||||
|
||||
|
||||
class TestLogoDownloaderHeaders:
|
||||
def test_uses_the_shared_headers(self):
|
||||
|
||||
@@ -424,7 +424,8 @@ class TestPlaceholderLogo:
|
||||
|
||||
class TestSessionConfiguration:
|
||||
def test_user_agent_and_accept_headers(self, helper):
|
||||
assert helper.session.headers["User-Agent"] == "LEDMatrix-Common/1.0"
|
||||
from src.common.api_helper import USER_AGENT
|
||||
assert helper.session.headers["User-Agent"] == USER_AGENT
|
||||
assert helper.session.headers["Accept"] == "image/*"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user