Default validateStatus
function should print HTTP response body on error
#459
Labels
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Current behavior
If an HTTP request returns an invalid status code, gaxios will return a
Request Failed with status code <CODE>
error. (Relevant code here)This doesn't give me lots of information as to why the error occurred (without wrapping the
request
call in atry...except
block - this feels clunky IMHO), which is useful when debugging.Expected behavior
gaxios
should include the HTTP response body in the message - something like:Alternatively,
validateStatus
could be an opt-in behavior to allow for manual assertion of status code and/or response contents.Workaround
In the meantime, I've been working around this by using a custom
validateStatus
function set toTrue
.The text was updated successfully, but these errors were encountered: