close http body where possible
This commit is contained in:
18
main.go
18
main.go
@@ -205,6 +205,8 @@ func housekeeping() {
|
||||
}
|
||||
|
||||
func getPlayerMeta(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
id := mux.Vars(r)["id"]
|
||||
l := mux.Vars(r)["limit"]
|
||||
|
||||
@@ -309,6 +311,8 @@ func getPlayerMeta(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getPlayer(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
id := mux.Vars(r)["id"]
|
||||
t := mux.Vars(r)["time"]
|
||||
|
||||
@@ -430,6 +434,8 @@ func getPlayer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func deletePlayerTrack(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
log.Infof("[DPT] Unable to parse form data: %v", err)
|
||||
@@ -478,6 +484,8 @@ func deletePlayerTrack(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func postPlayerTrack(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
log.Infof("[PPT] Unable to parse form data: %v", err)
|
||||
@@ -540,6 +548,8 @@ func postPlayerTrack(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getMatchParse(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
shareCode := mux.Vars(r)["sharecode"]
|
||||
|
||||
if shareCode == "" || !utils.ShareCodeRegEx.MatchString(shareCode) {
|
||||
@@ -561,6 +571,8 @@ func getMatchParse(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getMatchRounds(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
id := mux.Vars(r)["id"]
|
||||
|
||||
if id == "" {
|
||||
@@ -608,6 +620,8 @@ func getMatchRounds(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getMatchWeapons(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
id := mux.Vars(r)["id"]
|
||||
|
||||
if id == "" {
|
||||
@@ -698,6 +712,8 @@ func getMatchWeapons(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getMatches(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
t := mux.Vars(r)["time"]
|
||||
|
||||
var offsetTime time.Time
|
||||
@@ -770,6 +786,8 @@ func getMatches(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getMatch(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
id := mux.Vars(r)["id"]
|
||||
|
||||
if id == "" {
|
||||
|
Reference in New Issue
Block a user