@@ -764,7 +764,7 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=None, *
764764
765765 @_authentication
766766 @_log_duration
767- def request (self , path_segment , method = "GET" , headers = None , body = "" ,
767+ def request (self , path_segment , method = "GET" , headers = None , body = {} ,
768768 owner = None , app = None , sharing = None ):
769769 """Issues an arbitrary HTTP request to the REST path segment.
770770
@@ -824,13 +824,28 @@ def request(self, path_segment, method="GET", headers=None, body="",
824824 path = self .authority \
825825 + self ._abspath (path_segment , owner = owner ,
826826 app = app , sharing = sharing )
827+
827828 all_headers = headers + self .additional_headers + self ._auth_headers
828829 logging .debug ("%s request to %s (headers: %s, body: %s)" ,
829830 method , path , str (all_headers ), repr (body ))
830- response = self .http .request (path ,
831- {'method' : method ,
832- 'headers' : all_headers ,
833- 'body' : body })
831+
832+ if body :
833+ body = _encode (** body )
834+
835+ if method == "GET" :
836+ path = path + UrlEncoded ('?' + body , skip_encode = True )
837+ message = {'method' : method ,
838+ 'headers' : all_headers }
839+ else :
840+ message = {'method' : method ,
841+ 'headers' : all_headers ,
842+ 'body' : body }
843+ else :
844+ message = {'method' : method ,
845+ 'headers' : all_headers }
846+
847+ response = self .http .request (path , message )
848+
834849 return response
835850
836851 def login (self ):
0 commit comments