Skip to content

Fix key= auth: Include headers set by BaseEngine() in requests #354

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion redminelib/engines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def construct_request_kwargs(self, method, headers, params, data):
:param data: (required). Data to send in the body of the request.
:type data: dict, bytes or file-like object
"""
kwargs = dict(self.requests, **{'data': data or {}, 'params': params or {}, 'headers': headers or {}})
# headers may be supplied in __init__; merge in any newly-requested headers
if 'headers' in self.requests:
merged_headers = self.requests['headers'] | (headers or {})
kwargs = dict(self.requests, **{'data': data or {}, 'params': params or {}, 'headers': merged_headers})

if method in ('post', 'put', 'patch') and 'Content-Type' not in kwargs['headers']:
kwargs['data'] = json.dumps(data)
Expand Down