Skip to content

Commit

Permalink
Add log
Browse files Browse the repository at this point in the history
  • Loading branch information
ashep committed Dec 25, 2024
1 parent 59afe07 commit f1cb164
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions httplogwriter/httplogwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"net/url"
"os"
"strings"
)

type httpClient interface {
Expand Down Expand Up @@ -67,6 +68,11 @@ func (l *Writer) Write(b []byte) (int, error) {
}()
}

if res.StatusCode == http.StatusUnauthorized || res.StatusCode == http.StatusForbidden {
return 0, fmt.Errorf("%s: username=%q, password=%q",
res.Status, l.user, strings.Repeat("x", len(l.passwd)))
}

if res.StatusCode != http.StatusCreated {
return 0, fmt.Errorf("invalid response status code: %d", res.StatusCode)
}
Expand Down

0 comments on commit f1cb164

Please sign in to comment.