use acceptedResponseStatusCode everywhere in HTTP logger (#13755)

This commit is contained in:
Harshavardhana 2021-11-24 13:53:11 -08:00 committed by GitHub
parent 932500e43d
commit fee3f88cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -37,9 +37,12 @@ verify_checksum_mc() {
}
add_alias() {
for i in $(seq 1 4); do
echo "... attempting to add alias $i"
until (mc alias set minio http://127.0.0.1:9000 minioadmin minioadmin); do
echo "...waiting... for 5secs" && sleep 5
done
done
}
__init__() {

View File

@ -157,7 +157,7 @@ func (h *Target) startHTTPLogger() {
// Drain any response.
xhttp.DrainBody(resp.Body)
if resp.StatusCode != http.StatusOK {
if !acceptedResponseStatusCode(resp.StatusCode) {
switch resp.StatusCode {
case http.StatusForbidden:
h.config.LogOnce(ctx, fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", h.config.Endpoint, resp.Status), h.config.Endpoint)