Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gavriel-hc committed May 10, 2022
1 parent fb2a4c5 commit b0b7363
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ var (
type ReaderFunc func() (io.Reader, error)

// ResponseHandlerFunc is a type of function that takes in a Response, and does something with it.
// If an error is returned, the client's retry policy will be used to determine
// The ResponseHandlerFunc is called when the HTTP client successfully receives a response and the
// CheckRetry function indicates that a retry of the base request is not necessary.
// If an error is returned from this function, the CheckRetry policy will be used to determine
// whether to retry the whole request (including this handler).
// NOTE: It only runs if the initial part of the request was successful.
// Make sure to check status codes! Even if the request was "successful" it may have a non-2xx status code.
// NOTE: If there is a response body, users should make sure to close it to avoid a memory leak.
//
// Make sure to check status codes! Even if the request was completed it may have a non-2xx status code.
//
// The response body is not automatically closed. It must be closed either by the ResponseHandlerFunc or
// by the caller out-of-band. Failure to do so will result in a memory leak.
type ResponseHandlerFunc func(*http.Response) error

// LenReader is an interface implemented by many in-memory io.Reader's. Used
Expand Down

0 comments on commit b0b7363

Please sign in to comment.