Skip to content

Commit

Permalink
forward all requests params to request method
Browse files Browse the repository at this point in the history
  • Loading branch information
timerke authored Aug 28, 2024
1 parent 3ad62f4 commit 2a123b6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions redminelib/engines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def create_session(**params):
"""
raise NotImplementedError

@staticmethod
def construct_request_kwargs(method, headers, params, data):
def construct_request_kwargs(self, method, headers, params, data):
"""
Constructs kwargs that will be used in all requests to Redmine.
Expand All @@ -61,12 +60,12 @@ def construct_request_kwargs(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 = {'data': data or {}, 'params': params or {}, 'headers': headers or {}}

kwargs = dict(self.requests, **{'data': data or {}, 'params': params or {}, 'headers': headers or {}})

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

return kwargs

def request(self, method, url, headers=None, params=None, data=None):
Expand Down

0 comments on commit 2a123b6

Please sign in to comment.