You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The utility module http.query and the corresponding execution/runner modules don't return the response body when the HTTP error code is not 200.
Please be as specific as possible and give set-up details.
on-prem machine
VM (Virtualbox, KVM, etc. please specify)
VM running on a cloud service, please be explicit and add details
container (Kubernetes, Docker, containerd, etc. please specify)
or a combination, please be explicit
jails if it is FreeBSD
classic packaging
onedir packaging
used bootstrap to install
Steps to Reproduce the behavior
salt-run http.query http://localhost:8087/object/totp/580969d5-0c3e-4629-99bf-64185b07b588
error:
HTTP 400: Bad Request
status:
400
Here's the equivalent curl output for comparison:
curl -i http://localhost:8087/object/totp/580969d5-0c3e-4629-99bf-64185b07b588
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 63
Date: Thu, 26 Jan 2023 07:29:34 GMT
Connection: keep-alive
Keep-Alive: timeout=5
{"success":false,"message":"No TOTP available for this login."}
Expected behavior
Return the response body (if it exists) in addition to status code and error:
salt-run http.query http://localhost:8087/object/totp/580969d5-0c3e-4629-99bf-64185b07b588
body:
{"success":false,"message":"No TOTP available for this login."}
error:
HTTP 400: Bad Request
status:
400
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 3005.1Dependency Versions:
cffi: Not Installedcherrypy: Not Installeddateutil: 2.6.1docker-py: Not Installedgitdb: Not Installedgitpython: Not InstalledJinja2: 2.10.1libgit2: Not InstalledM2Crypto: 0.35.2Mako: Not Installedmsgpack: 0.6.2msgpack-pure: Not Installedmysql-python: Not Installedpycparser: Not Installedpycrypto: Not Installedpycryptodome: Not Installedpygit2: Not InstalledPython: 3.6.8 (default, Nov 9 2022, 09:57:34)python-gnupg: Not InstalledPyYAML: 3.12PyZMQ: 20.0.0smmap: Not Installedtimelib: Not InstalledTornado: 4.5.3ZMQ: 4.3.4Salt Extensions:
saltext.bitwarden: 0.0.1b11System Versions:
dist: almalinux 8.7 Stone Smilodonlocale: UTF-8machine: x86_64release: 4.18.0-425.3.1.el8.x86_64system: Linuxversion: AlmaLinux 8.7 Stone Smilodon
Additional context
Here's the relevant section of code:
If I insert the following line between lines 620 and 621:
ret["body"] = exc.response.body
I can get the desired output (albeit without support for options like decode or decode_body), and tornado.httpclient does generate a response object when an HTTPError/HTTPClientError is thrown per this.
The text was updated successfully, but these errors were encountered:
Description
The utility module http.query and the corresponding execution/runner modules don't return the response body when the HTTP error code is not
200
.Setup
Set up a generic web server. I'm using the
bw serve
Bitwarden Vault Management REST API server in this case. Make a query to a URL that will return an HTTP 400.Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
Here's the equivalent
curl
output for comparison:Expected behavior
Return the response body (if it exists) in addition to status code and error:
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
Here's the relevant section of code:
salt/salt/utils/http.py
Lines 618 to 621 in b59884b
If I insert the following line between lines 620 and 621:
I can get the desired output (albeit without support for options like
decode
ordecode_body
), andtornado.httpclient
does generate aresponse
object when anHTTPError
/HTTPClientError
is thrown per this.The text was updated successfully, but these errors were encountered: