From 0268d4fc8ef89b26bd0e9867dd2c979fb6f4e0b2 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 14 Apr 2020 18:17:30 +0100 Subject: [PATCH] space -> hyphen in Accept-Language, capatilise in test --- synapse/rest/media/v1/preview_url_resource.py | 2 +- tests/rest/media/v1/test_url_preview.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py index af11a6b69e..f68e18ea8a 100644 --- a/synapse/rest/media/v1/preview_url_resource.py +++ b/synapse/rest/media/v1/preview_url_resource.py @@ -321,7 +321,7 @@ class PreviewUrlResource(DirectServeResource): url, output_stream=f, max_size=self.max_spider_size, - headers={"Accept Language": self.url_preview_accept_language}, + headers={"Accept-Language": self.url_preview_accept_language}, ) except SynapseError: # Pass SynapseErrors through directly, so that the servlet diff --git a/tests/rest/media/v1/test_url_preview.py b/tests/rest/media/v1/test_url_preview.py index bebc94ecab..2826211f32 100644 --- a/tests/rest/media/v1/test_url_preview.py +++ b/tests/rest/media/v1/test_url_preview.py @@ -555,10 +555,10 @@ class URLPreviewTests(unittest.HomeserverTestCase): # of the request from Synapse self.assertIn( ( - b"Accept language: en-UK\r\n" - b"Accept language: en-US;q=0.9\r\n" - b"Accept language: fr;q=0.8\r\n" - b"Accept language: *;q=0.7" + b"Accept-Language: en-UK\r\n" + b"Accept-Language: en-US;q=0.9\r\n" + b"Accept-Language: fr;q=0.8\r\n" + b"Accept-Language: *;q=0.7" ), server.data, )