@@ -754,7 +754,7 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=None, *
754754
755755 @_authentication
756756 @_log_duration
757- def request (self , path_segment , method = "GET" , headers = None , body = "" ,
757+ def request (self , path_segment , method = "GET" , headers = None , body = {} ,
758758 owner = None , app = None , sharing = None ):
759759 """Issues an arbitrary HTTP request to the REST path segment.
760760
@@ -814,13 +814,27 @@ def request(self, path_segment, method="GET", headers=None, body="",
814814 path = self .authority \
815815 + self ._abspath (path_segment , owner = owner ,
816816 app = app , sharing = sharing )
817+
817818 all_headers = headers + self .additional_headers + self ._auth_headers
818819 logging .debug ("%s request to %s (headers: %s, body: %s)" ,
819820 method , path , str (all_headers ), repr (body ))
820- response = self .http .request (path ,
821+
822+ if body :
823+ body = _encode (** body )
824+ if method == "GET" :
825+ path = path + UrlEncoded ('?' + body , skip_encode = True )
826+ response = self .http .request (path ,
821827 {'method' : method ,
822- 'headers' : all_headers ,
823- 'body' : body })
828+ 'headers' : all_headers })
829+ else :
830+ response = self .http .request (path ,
831+ {'method' : method ,
832+ 'headers' : all_headers ,
833+ 'body' : body })
834+ else :
835+ response = self .http .request (path ,
836+ {'method' : method ,
837+ 'headers' : all_headers })
824838 return response
825839
826840 def login (self ):
0 commit comments