Skip to content

Commit

Permalink
Merge pull request #39 from TaoZou1/bugfix
Browse files Browse the repository at this point in the history
Remove log response body
  • Loading branch information
TaoZou1 authored Jan 19, 2022
2 parents 2b07418 + 23da824 commit e2eb804
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions pkg/nsx/auth/jwt/vcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (client *VCClient) HandleRequest(urlPath string, data []byte, responseData
if err != nil {
return err
}
log.V(1).Info("HTTP request: %v, response %v", request, response)
log.V(1).Info("HTTP request", "request", request.URL, "response status", response.StatusCode)
if response.StatusCode == http.StatusUnauthorized {
if err = client.getorRenewVAPISession(); err != nil {
log.Error(err, "failed to renew VAPI session")
Expand Down Expand Up @@ -275,7 +275,7 @@ func createCertificate(userName string) (*tls.Certificate, error) {

func handleHTTPResponse(response *http.Response, result interface{}) error {
if response.StatusCode >= 300 {
err := errors.New("Received HTTP Error")
err := errors.New("received HTTP Error")
log.Error(err, "handle http response", "status", response.StatusCode, "requestUrl", response.Request.URL, "response", response)
return err
}
Expand All @@ -292,7 +292,5 @@ func handleHTTPResponse(response *http.Response, result interface{}) error {
log.Error(err, "Error converting HTTP response to result", "result type", result)
return err
}
log.V(1).Info("response body", result)

return nil
}
2 changes: 1 addition & 1 deletion pkg/nsx/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func extractHTTPDetail(host string, resp *http.Response) (ErrorDetail, error) {
log.Error(err, "failed to extract HTTP detail")
return ed, CreateGeneralManagerError(host, "extract http", err.Error())
}
log.V(1).Info("extract http body", "response body", body)
//TODO, log some fields of response
resp.Body = ioutil.NopCloser(bytes.NewReader(body))
return extractHTTPDetailFromBody(host, resp.StatusCode, body)
}
Expand Down

0 comments on commit e2eb804

Please sign in to comment.