Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where equal sign could not be in value of header #84

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,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
Loading