Specify HTTP method

This commit is contained in:
Brendan Abolivier 2017-09-21 19:31:31 +02:00
parent e99ed378b6
commit 982a60a3a0
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -30,6 +30,7 @@ const pathPrefixR0 = "/_matrix/client/r0"
// Setup configures the given mux with sync-server listeners
func Setup(apiMux *mux.Router, srp *sync.RequestPool, deviceDB *devices.Database) {
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
r0mux.Handle("/sync", common.MakeAuthAPI("sync", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return srp.OnIncomingSyncRequest(req, device)
})).Methods("GET")
@ -37,5 +38,5 @@ func Setup(apiMux *mux.Router, srp *sync.RequestPool, deviceDB *devices.Database
r0mux.Handle("/rooms/{roomID}/state", common.MakeAuthAPI("room_state", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return srp.OnIncomingStateRequest(req, vars["roomID"])
}))
})).Methods("GET")
}