Skip to content

Commit

Permalink
fix: only close response body in oauth handler in case of no error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum authored Oct 19, 2022
1 parent 09dba21 commit 83ace48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions router/oauthResponseHandler/oauthResponseHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,14 @@ func (authErrHandler *OAuthErrResHandler) cpApiCall(cpReq *ControlPlaneRequestT)
"requestType": cpReq.RequestType,
}).SendTiming(time.Since(cpApiDoTimeStart))
authErrHandler.logger.Debugf("[%s request] :: destination request sent\n", loggerNm)
if res.Body != nil {
defer res.Body.Close()
}
if doErr != nil {
// Abort on receiving an error
authErrHandler.logger.Errorf("[%s request] :: destination request failed: %+v\n", loggerNm, doErr)
return http.StatusBadRequest, doErr.Error()
}
if res.Body != nil {
defer res.Body.Close()
}
statusCode, resp := processResponse(res)
return statusCode, resp
}
Expand Down

0 comments on commit 83ace48

Please sign in to comment.