Commit 06fa1d0
Changed files (1)
serverHandlers.go
@@ -168,6 +168,7 @@ func handlePostingTest(writer http.ResponseWriter, request *http.Request) error
// handleTestRequests creates an array of records for the client
// the requestion expects 1 parameter (numQuestions)
func handleTestQueries(writer http.ResponseWriter, request *http.Request) {
+ defer request.Body.Close()
if request.URL.Path != handlers[API_ROOT+"/test"].Request {
return
}
@@ -200,6 +201,7 @@ func handleRequestForCategories(writer http.ResponseWriter, request *http.Reques
// handleCategoryQueries returns the JSON-encoded array of categories available
// to the requesting body
func handleCategoryQueries(writer http.ResponseWriter, request *http.Request) {
+ defer request.Body.Close()
switch request.Method {
case "POST":
log.Printf("Client posting category: %+v\tvia %+v", request.RemoteAddr, request.UserAgent())
@@ -260,6 +262,7 @@ func validateUserFile(path string, fileInfo os.FileInfo, err error) error {
// handleScoreRequests gives the client the scores for the specified user name
func handleScoreRequests(writer http.ResponseWriter, request *http.Request) {
+ defer request.Body.Close()
switch request.Method {
case "POST":
log.Printf("Client attempted to POST to /%s/test/score: %+v\tvia %+v", API_ROOT, request.RemoteAddr, request.UserAgent())