Handle unexpected status codes in GetWebAPIVersion #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously the status code was not checked, so bad base paths or reverse proxies in front of unavailable qbittorrent instances would not trip the health check.
This endpoint is particularly critical because it's used for the client health check in QUI here:
https://github.com/autobrr/qui/blob/de0e00a6eda2f6988a42d4d426a5c3f960fa2063/internal/qbittorrent/client.go#L376-L388
Via this check, which only validates the response body is non-empty, where in many cases it includes a body along the lines of "404 Not Found".
https://github.com/autobrr/qui/blob/de0e00a6eda2f6988a42d4d426a5c3f960fa2063/internal/qbittorrent/client.go#L200-L226
There are several other endpoints which don't check the response status codes, I'd be happy to update them in follow-up commits.