Skip to content

Commit

Permalink
transport/http: Remove WrapLogClient
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Nov 4, 2020
1 parent 11b800b commit c69fa76
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions transport/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/http"
"net/http/httputil"

smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smithy-go/middleware"
Expand Down Expand Up @@ -107,28 +106,6 @@ func (e *RequestSendError) Error() string {
return fmt.Sprintf("request send failed, %v", e.Err)
}

// WrapLogClient logs the client's HTTP request and response of a round tripped
// request.
func WrapLogClient(logger interface{ Logf(string, ...interface{}) }, client ClientDo, withBody bool) ClientDo {
return ClientDoFunc(func(r *http.Request) (*http.Response, error) {
b, err := httputil.DumpRequest(r, withBody)
logger.Logf("Request\n%v", string(b))

resp, err := client.Do(r)
if err != nil {
return nil, err
}

b, err = httputil.DumpResponse(resp, withBody)
if err != nil {
return nil, fmt.Errorf("failed to dump response %w", err)
}
logger.Logf("Response\n%v", string(b))

return resp, nil
})
}

// NopClient provides a client that ignores the request, and returns a empty
// successful HTTP response value.
type NopClient struct{}
Expand Down

0 comments on commit c69fa76

Please sign in to comment.