Using a method that has a Prefer header hardcoded in the request, like Calendar.get_event() which specifies response = self.con.get(url, params=params, ={'Prefer': 'outlook.timezone="UTC"'}) would override Connection.default_headers['Prefer']. This change concatenates the values.
method = 'get'
if method not in _allowed_methods:
raise ValueError('Method must be one of: {}'.format(_allowed_methods))
Improved error message when using an invalid method:
method = 'this should fail'
if method not in _allowed_methods:
raise ValueError('Method must be one of: {}'.format(_allowed_methods))
Traceback (most recent call last):
File "/snap/pycharm-professional/364/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
^^^^^^
File "<input>", line 4, in <module>
ValueError: Method must be one of: ['get', 'post', 'put', 'patch', 'delete']
Added support for multiple Prefer headers in the Connection class. Clarified unsupported method error message.
Added support for multiple Prefer headers in the Connection class
Assuming something like:
Using a method that has a Prefer header hardcoded in the request, like Calendar.get_event() which specifies
response = self.con.get(url, params=params, ={'Prefer': 'outlook.timezone="UTC"'})
would overrideConnection.default_headers['Prefer']
. This change concatenates the values.Before:
After:
Clarified unsupported method error message
Assuming something like:
No error when using a valid method:
Improved error message when using an invalid method: