Skip to content

Commit 352fc05

Browse files
Changed allowed methods check
1 parent 19b02dd commit 352fc05

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

messagebird/http_client.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ def request(self, path, method='GET', params=None, format=ResponseFormat.text):
4343
'POST': lambda: requests.post(url, verify=True, headers=headers, data=json_serialize(params)),
4444
'PUT': lambda: requests.put(url, verify=True, headers=headers, data=json_serialize(params))
4545
}
46-
response = method_switcher.get(method, str(method) + ' is not a supported HTTP method')
47-
if isinstance(response, str):
48-
raise ValueError(response)
49-
response = response()
46+
if method not in method_switcher:
47+
raise ValueError(str(method) + ' is not a supported HTTP method')
48+
49+
response = method_switcher[method]()
5050

5151
if response.status_code not in self.__supported_status_codes:
5252
response.raise_for_status()

0 commit comments

Comments
 (0)