File tree Expand file tree Collapse file tree 2 files changed +14
-20
lines changed
Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -1178,23 +1178,20 @@ async def raw_request(
11781178 continue
11791179 query_params_list .append ((key , str (value )))
11801180
1181- body_params = None
1182- if body is not None :
1183- if isinstance (body , (dict , list )):
1184- body_params = json . dumps ( body )
1181+ body_params = body
1182+ if "Content-Type" not in request_headers :
1183+ if isinstance (body , (dict , list )) or body is None :
1184+ request_headers [ "Content-Type" ] = "application/ json"
11851185 elif isinstance (body , str ):
1186- body_params = body
1186+ request_headers [ "Content-Type" ] = "text/plain"
11871187 elif isinstance (body , bytes ):
1188- body_params = body
1188+ request_headers [ "Content-Type" ] = "application/octet-stream"
11891189 else :
1190- body_params = json . dumps ( body )
1190+ request_headers [ "Content-Type" ] = "application/ json"
11911191
11921192 retry_params = None
11931193 if options and options .get ("retry_params" ):
11941194 retry_params = options ["retry_params" ]
1195-
1196- if "Content-Type" not in request_headers :
1197- request_headers ["Content-Type" ] = "application/json"
11981195 if "Accept" not in request_headers :
11991196 request_headers ["Accept" ] = "application/json"
12001197
Original file line number Diff line number Diff line change @@ -1178,23 +1178,20 @@ def raw_request(
11781178 continue
11791179 query_params_list .append ((key , str (value )))
11801180
1181- body_params = None
1182- if body is not None :
1183- if isinstance (body , (dict , list )):
1184- body_params = json . dumps ( body )
1181+ body_params = body
1182+ if "Content-Type" not in request_headers :
1183+ if isinstance (body , (dict , list )) or body is None :
1184+ request_headers [ "Content-Type" ] = "application/ json"
11851185 elif isinstance (body , str ):
1186- body_params = body
1186+ request_headers [ "Content-Type" ] = "text/plain"
11871187 elif isinstance (body , bytes ):
1188- body_params = body
1188+ request_headers [ "Content-Type" ] = "application/octet-stream"
11891189 else :
1190- body_params = json . dumps ( body )
1190+ request_headers [ "Content-Type" ] = "application/ json"
11911191
11921192 retry_params = None
11931193 if options and options .get ("retry_params" ):
11941194 retry_params = options ["retry_params" ]
1195-
1196- if "Content-Type" not in request_headers :
1197- request_headers ["Content-Type" ] = "application/json"
11981195 if "Accept" not in request_headers :
11991196 request_headers ["Accept" ] = "application/json"
12001197
You can’t perform that action at this time.
0 commit comments