From 590c61bacd2135d7762f96167c32385d28d6c4d6 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Tue, 12 Sep 2017 17:53:46 +0100 Subject: [PATCH] Specify HTTP methods for the media API --- .../matrix-org/dendrite/mediaapi/routing/routing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/routing/routing.go b/src/github.com/matrix-org/dendrite/mediaapi/routing/routing.go index 9243c9123..85a40362a 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/routing/routing.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/routing/routing.go @@ -41,17 +41,17 @@ func Setup(apiMux *mux.Router, cfg *config.Dendrite, db *storage.Database) { // FIXME: /upload should use common.MakeAuthAPI() r0mux.Handle("/upload", common.MakeAPI("upload", func(req *http.Request) util.JSONResponse { return writers.Upload(req, cfg, db, activeThumbnailGeneration) - })) + })).Methods("POST", "OPTIONS") activeRemoteRequests := &types.ActiveRemoteRequests{ MXCToResult: map[string]*types.RemoteRequestResult{}, } r0mux.Handle("/download/{serverName}/{mediaId}", makeDownloadAPI("download", cfg, db, activeRemoteRequests, activeThumbnailGeneration), - ) + ).Methods("GET") r0mux.Handle("/thumbnail/{serverName}/{mediaId}", makeDownloadAPI("thumbnail", cfg, db, activeRemoteRequests, activeThumbnailGeneration), - ) + ).Methods("GET") } func makeDownloadAPI(name string, cfg *config.Dendrite, db *storage.Database, activeRemoteRequests *types.ActiveRemoteRequests, activeThumbnailGeneration *types.ActiveThumbnailGeneration) http.HandlerFunc {