Skip to content

Commit

Permalink
Fix bug where equal sign could not be in value of header (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugosjoberg authored Nov 30, 2023
1 parent 8b666c3 commit 11482ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 11482ba

Please sign in to comment.