mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
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:
parent
bff60953f3
commit
504d23f468
7 changed files with 2 additions and 57 deletions
|
@ -55,7 +55,7 @@ type downloadRequest struct {
|
|||
Logger *log.Entry
|
||||
}
|
||||
|
||||
// Download implements /download amd /thumbnail
|
||||
// Download implements GET /download and GET /thumbnail
|
||||
// Files from this server (i.e. origin == cfg.ServerName) are served directly
|
||||
// Files from remote servers (i.e. origin != cfg.ServerName) are cached locally.
|
||||
// If they are present in the cache, they are served directly.
|
||||
|
@ -107,14 +107,6 @@ func Download(
|
|||
}
|
||||
|
||||
// request validation
|
||||
if req.Method != http.MethodGet {
|
||||
dReq.jsonErrorResponse(w, util.JSONResponse{
|
||||
Code: http.StatusMethodNotAllowed,
|
||||
JSON: jsonerror.Unknown("request method must be GET"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if resErr := dReq.Validate(); resErr != nil {
|
||||
dReq.jsonErrorResponse(w, *resErr)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue