mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-05-17 06:09:29 +00:00
feat(session): translate requests 'data' kwarg to rnet equivalents for compatibility
This commit is contained in:
@@ -480,6 +480,16 @@ class RnetSession:
|
||||
# Remove kwargs rnet doesn't understand
|
||||
kwargs.pop("stream", None) # rnet responses are always lazy
|
||||
|
||||
# Translate requests-compatible 'data' kwarg to rnet equivalents
|
||||
data = kwargs.pop("data", None)
|
||||
if data is not None:
|
||||
if isinstance(data, dict):
|
||||
kwargs["form"] = list(data.items())
|
||||
elif isinstance(data, (str, bytes)):
|
||||
kwargs["body"] = data
|
||||
else:
|
||||
kwargs["body"] = data
|
||||
|
||||
# Resolve method enum
|
||||
rnet_method = _METHOD_MAP.get(method_upper)
|
||||
if rnet_method is None:
|
||||
|
||||
Reference in New Issue
Block a user