@@ -613,7 +613,7 @@ def delete(self, path_segment, owner=None, app=None, sharing=None, **query):
613613
614614 @_authentication
615615 @_log_duration
616- def get (self , path_segment , owner = None , app = None , sharing = None , ** query ):
616+ def get (self , path_segment , owner = None , app = None , headers = None , sharing = None , ** query ):
617617 """Performs a GET operation from the REST path segment with the given
618618 namespace and query.
619619
@@ -636,6 +636,8 @@ def get(self, path_segment, owner=None, app=None, sharing=None, **query):
636636 :type owner: ``string``
637637 :param app: The app context of the namespace (optional).
638638 :type app: ``string``
639+ :param headers: List of extra HTTP headers to send (optional).
640+ :type headers: ``list`` of 2-tuples.
639641 :param sharing: The sharing mode of the namespace (optional).
640642 :type sharing: ``string``
641643 :param query: All other keyword arguments, which are used as query
@@ -663,10 +665,14 @@ def get(self, path_segment, owner=None, app=None, sharing=None, **query):
663665 c.logout()
664666 c.get('apps/local') # raises AuthenticationError
665667 """
668+ if headers is None :
669+ headers = []
670+
666671 path = self .authority + self ._abspath (path_segment , owner = owner ,
667672 app = app , sharing = sharing )
668673 logging .debug ("GET request to %s (body: %s)" , path , repr (query ))
669- response = self .http .get (path , self ._auth_headers , ** query )
674+ all_headers = headers + self ._auth_headers
675+ response = self .http .get (path , all_headers , ** query )
670676 return response
671677
672678 @_authentication
@@ -1190,7 +1196,7 @@ def post(self, url, headers=None, **kwargs):
11901196 # to support the receivers/stream endpoint.
11911197 if 'body' in kwargs :
11921198 # We only use application/x-www-form-urlencoded if there is no other
1193- # Content-Type header present. This can happen in cases where we
1199+ # Content-Type header present. This can happen in cases where we
11941200 # send requests as application/json, e.g. for KV Store.
11951201 if len ([x for x in headers if x [0 ].lower () == "content-type" ]) == 0 :
11961202 headers .append (("Content-Type" , "application/x-www-form-urlencoded" ))
0 commit comments