Skip to content

Commit

Permalink
Always send request bodies as json (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipflohr authored Nov 24, 2020
1 parent 2bb8a03 commit 929ed26
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/personio_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def request(self, path: str, method='GET', params: Dict[str, Any] = None,
_headers.update(headers)
# make the request
url = urljoin(self.base_url, path)
response = requests.request(method, url, headers=_headers, params=params, data=data)
response = requests.request(method, url, headers=_headers, params=params, json=data)
# re-new the authorization header
authorization = response.headers.get('Authorization')
if authorization:
Expand All @@ -127,8 +127,7 @@ def request_json(self, path: str, method='GET', params: Dict[str, Any] = None,
during this request (default: True for json requests)
:return: the parsed json response, when the request was successful, or a PersonioApiError
"""
headers = {'accept': 'application/json'}
response = self.request(path, method, params, data, headers, auth_rotation=auth_rotation)
response = self.request(path, method, params, data, auth_rotation=auth_rotation)
if response.ok:
try:
return response.json()
Expand Down

0 comments on commit 929ed26

Please sign in to comment.