Skip to content

Commit d02c11b

Browse files
committed
docs: Add documentation to the checkResponse function.
1 parent 593f1e9 commit d02c11b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

http.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ func permanentErrorCode(c int) bool {
7676
c == http.StatusNotImplemented
7777
}
7878

79+
// checkResponse checks the HTTP response for retryable errors.
80+
//
81+
// Temporary errors are returned as an error and are therefore retried.
82+
//
83+
// Permanent errors are *not* returned as an error and are therefore *not* retried.
84+
// An argument could be made to return them as a permanent error, too.
85+
// However, this would mean a significant diversion from the standard net/http semantic.
86+
//
87+
// If err is not nil, it is wrapped in permanentError and returned.
7988
func checkResponse(res *http.Response, err error) error {
8089
if err != nil {
8190
if _, ok := err.(Error); ok {

0 commit comments

Comments
 (0)