[python] added handling for boolean content type (#17020)

* added handling for boolean content type

* adapted addition to newer version of template

* [python] updated samples
This commit is contained in:
OliverTetzTT
2023-11-14 04:30:10 +01:00
committed by GitHub
parent 8860d967c0
commit d1b148a7d3
4 changed files with 36 additions and 0 deletions

View File

@@ -209,6 +209,15 @@ class RESTClientObject:
headers=headers,
preload_content=False
)
elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool):
request_body = "true" if body else "false"
r = self.pool_manager.request(
method,
url,
body=request_body,
preload_content=False,
timeout=timeout,
headers=headers)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided