@@ -578,7 +578,7 @@ def get(self, path_segment, owner=None, app=None, sharing=None, **query):
578578
579579 @_authentication
580580 @_log_duration
581- def post (self , path_segment , owner = None , app = None , sharing = None , headers = [] , ** query ):
581+ def post (self , path_segment , owner = None , app = None , sharing = None , headers = None , ** query ):
582582 """Performs a POST operation from the REST path segment with the given
583583 namespace and query.
584584
@@ -638,6 +638,9 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=[], **q
638638 c.post('saved/searches', name='boris',
639639 search='search * earliest=-1m | head 1')
640640 """
641+ if headers is None :
642+ headers = []
643+
641644 path = self .authority + self ._abspath (path_segment , owner = owner ,
642645 app = app , sharing = sharing )
643646 logging .debug ("POST request to %s (body: %s)" , path , repr (query ))
@@ -653,7 +656,7 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=[], **q
653656
654657 @_authentication
655658 @_log_duration
656- def request (self , path_segment , method = "GET" , headers = [] , body = "" ,
659+ def request (self , path_segment , method = "GET" , headers = None , body = "" ,
657660 owner = None , app = None , sharing = None ):
658661 """Issues an arbitrary HTTP request to the REST path segment.
659662
@@ -701,6 +704,9 @@ def request(self, path_segment, method="GET", headers=[], body="",
701704 c.logout()
702705 c.get('apps/local') # raises AuthenticationError
703706 """
707+ if headers is None :
708+ headers = []
709+
704710 path = self .authority \
705711 + self ._abspath (path_segment , owner = owner ,
706712 app = app , sharing = sharing )
0 commit comments