mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
httpapi: Split off and save response text contents (#43305)
* Split off and save response text contents * login might depend on httpapi
This commit is contained in:
parent
13dd1acbec
commit
ab40c72a3c
4 changed files with 22 additions and 17 deletions
|
@ -27,14 +27,13 @@ class HttpApi(HttpApiBase):
|
|||
request = request_builder(queue, output)
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
|
||||
response = self.connection.send('/ins', request, headers=headers, method='POST')
|
||||
response_text = to_text(response.read())
|
||||
response, response_text = self.connection.send('/ins', request, headers=headers, method='POST')
|
||||
try:
|
||||
response = json.loads(response_text)
|
||||
response_text = json.loads(response_text)
|
||||
except ValueError:
|
||||
raise ConnectionError('Response was not valid JSON, got {0}'.format(response_text))
|
||||
|
||||
results = handle_response(response)
|
||||
results = handle_response(response_text)
|
||||
|
||||
if self._become:
|
||||
results = results[1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue