Remove unnecessary http method checks (#747)

Closes #523

There were a lot of unnecessary checks for HTTP methods of requests. gorilla/mux makes sure that these methods will only be called if certain HTTP methods are used, thus there's no reason to have these extra checks.
This commit is contained in:
Andrew Morgan 2019-07-18 08:40:10 +01:00 committed by Alex Chen
parent bff60953f3
commit 504d23f468
7 changed files with 2 additions and 57 deletions

View file

@ -37,12 +37,6 @@ import (
func GetProfile(
req *http.Request, accountDB *accounts.Database, userID string, asAPI appserviceAPI.AppServiceQueryAPI,
) util.JSONResponse {
if req.Method != http.MethodGet {
return util.JSONResponse{
Code: http.StatusMethodNotAllowed,
JSON: jsonerror.NotFound("Bad method"),
}
}
profile, err := appserviceAPI.RetrieveUserProfile(req.Context(), userID, asAPI, accountDB)
if err != nil {
return httputil.LogThenError(req, err)