From 11482ba95c828c996aae3ce9018e701d2aa49d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Sj=C3=B6berg?= Date: Thu, 30 Nov 2023 12:06:37 -0800 Subject: [PATCH] Fix bug where equal sign could not be in value of header (#84) --- pinotdb/db.py | 2 +- tests/unit/test_db.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pinotdb/db.py b/pinotdb/db.py index ac0e476..ccd95b3 100644 --- a/pinotdb/db.py +++ b/pinotdb/db.py @@ -331,7 +331,7 @@ def __init__( extra_headers = {} if extra_request_headers: for header in extra_request_headers.split(","): - k, v = header.split("=") + k, v = header.split("=", 1) extra_headers[k] = v self.session.headers.update(extra_headers) diff --git a/tests/unit/test_db.py b/tests/unit/test_db.py index c09e6fb..6af6209 100644 --- a/tests/unit/test_db.py +++ b/tests/unit/test_db.py @@ -331,10 +331,11 @@ def test_instantiates_with_auth(self): def test_instantiates_with_extra_headers(self): cursor = db.Cursor( host='localhost', session=httpx.Client(), - extra_request_headers='foo=bar,baz=yo') + extra_request_headers='foo=bar,baz=yo,Authorization=Bearer foo=') self.assertEqual(cursor.session.headers['foo'], 'bar') self.assertEqual(cursor.session.headers['baz'], 'yo') + self.assertEqual(cursor.session.headers['Authorization'], 'Bearer foo=') def test_checks_valid_exception_if_not_containing_error_code(self): cursor = db.Cursor(host='localhost', session=httpx.Client())