Add content-type default headers with application/json
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
VERSION = (5, 1, 0)
|
||||
VERSION = (5, 2, 0, 'dev')
|
||||
__version__ = VERSION
|
||||
__versionstr__ = '.'.join(map(str, VERSION))
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ class RequestsHttpConnection(Connection):
|
||||
|
||||
super(RequestsHttpConnection, self).__init__(host=host, port=port, **kwargs)
|
||||
self.session = requests.Session()
|
||||
self.session.headers = headers
|
||||
self.session.headers = headers or {}
|
||||
self.session.headers.setdefault('content-type', 'application/json')
|
||||
if http_auth is not None:
|
||||
if isinstance(http_auth, (tuple, list)):
|
||||
http_auth = tuple(http_auth)
|
||||
|
||||
@@ -61,6 +61,7 @@ class Urllib3HttpConnection(Connection):
|
||||
for k in headers:
|
||||
self.headers[k.lower()] = headers[k]
|
||||
|
||||
self.headers.setdefault('content-type', 'application/json')
|
||||
ca_certs = CA_CERTS if ca_certs is None else ca_certs
|
||||
pool_class = urllib3.HTTPConnectionPool
|
||||
kw = {}
|
||||
|
||||
Reference in New Issue
Block a user