defer body close after encoding json
This commit is contained in:
parent
d7843d18d0
commit
657be66948
|
@ -259,11 +259,13 @@ func getOauthUser(dbConn *sql.DB, client *http.Client, uri string) (*database.Us
|
||||||
}
|
}
|
||||||
|
|
||||||
func createUserFromResponse(response *http.Response) (*database.User, error) {
|
func createUserFromResponse(response *http.Response) (*database.User, error) {
|
||||||
defer response.Body.Close()
|
|
||||||
user := &database.User{
|
user := &database.User{
|
||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := json.NewDecoder(response.Body).Decode(user)
|
err := json.NewDecoder(response.Body).Decode(user)
|
||||||
|
defer response.Body.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue