summaryrefslogtreecommitdiffstats
path: root/app/oauth.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-09 14:59:48 -0700
committerGitHub <noreply@github.com>2017-10-09 14:59:48 -0700
commitbff2b5e735ae7fc80157b4108ddbe56be8acb752 (patch)
tree14867d2bff71b6b638b0b358b1f38eb062cb597f /app/oauth.go
parent0f66b6e72621842467d0e368b95ee58f485d4ace (diff)
downloadchat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.tar.gz
chat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.tar.bz2
chat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.zip
Miscellaneous app cleanup (#7594)
* app cleanup * whoops, forgot a file * some minor cleanup * longer container deadline * defensive checks
Diffstat (limited to 'app/oauth.go')
-rw-r--r--app/oauth.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/oauth.go b/app/oauth.go
index 6e411138b..909d16628 100644
--- a/app/oauth.go
+++ b/app/oauth.go
@@ -7,7 +7,6 @@ import (
"bytes"
b64 "encoding/base64"
"io"
- "io/ioutil"
"net/http"
"net/url"
"strings"
@@ -428,10 +427,7 @@ func (a *App) RevokeAccessToken(token string) *model.AppError {
}
func (a *App) CompleteOAuth(service string, body io.ReadCloser, teamId string, props map[string]string) (*model.User, *model.AppError) {
- defer func() {
- ioutil.ReadAll(body)
- body.Close()
- }()
+ defer body.Close()
action := props["action"]
@@ -688,11 +684,9 @@ func (a *App) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service
if resp, err := utils.HttpClient(true).Do(req); err != nil {
return nil, "", stateProps, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.token_failed.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
- bodyBytes, _ = ioutil.ReadAll(resp.Body)
- resp.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
-
ar = model.AccessResponseFromJson(resp.Body)
- defer CloseBody(resp)
+ resp.Body.Close()
+
if ar == nil {
return nil, "", stateProps, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.bad_response.app_error", nil, "response_body="+string(bodyBytes), http.StatusInternalServerError)
}