mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
Just call straight through
This commit is contained in:
parent
e96b5103a1
commit
e715a440d7
|
|
@ -6,11 +6,8 @@ import (
|
|||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
// Sync handles HTTP requests to /sync
|
||||
type Sync struct{}
|
||||
|
||||
// OnIncomingRequest implements util.JSONRequestHandler
|
||||
func (s *Sync) OnIncomingRequest(req *http.Request) (interface{}, *util.HTTPError) {
|
||||
// Sync implements /sync
|
||||
func Sync(req *http.Request) (interface{}, *util.HTTPError) {
|
||||
logger := util.GetLogger(req.Context())
|
||||
logger.Info("Doing stuff...")
|
||||
return nil, &util.HTTPError{
|
||||
|
|
|
|||
|
|
@ -17,14 +17,15 @@ const pathPrefixR0 = "/_matrix/client/r0"
|
|||
func Setup(servMux *http.ServeMux, httpClient *http.Client) {
|
||||
apiMux := mux.NewRouter()
|
||||
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
|
||||
r0mux.Handle("/sync", make("sync", &readers.Sync{}))
|
||||
r0mux.Handle("/sync", make("sync", wrap(func(req *http.Request) (interface{}, *util.HTTPError) {
|
||||
return readers.Sync(req)
|
||||
})))
|
||||
r0mux.Handle("/rooms/{roomID}/send/{eventType}",
|
||||
make("send_message", wrap(func(req *http.Request) (interface{}, *util.HTTPError) {
|
||||
vars := mux.Vars(req)
|
||||
roomID := vars["roomID"]
|
||||
eventType := vars["eventType"]
|
||||
h := &writers.SendMessage{}
|
||||
return h.OnIncomingRequest(req, roomID, eventType)
|
||||
return writers.SendMessage(req, roomID, eventType)
|
||||
})),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ import (
|
|||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
// SendMessage handles HTTP requests to /rooms/$room_id/send/$event_type
|
||||
type SendMessage struct {
|
||||
}
|
||||
|
||||
// OnIncomingRequest implements /rooms/{roomID}/send/{eventType}
|
||||
func (s *SendMessage) OnIncomingRequest(req *http.Request, roomID, eventType string) (interface{}, *util.HTTPError) {
|
||||
// SendMessage implements /rooms/{roomID}/send/{eventType}
|
||||
func SendMessage(req *http.Request, roomID, eventType string) (interface{}, *util.HTTPError) {
|
||||
logger := util.GetLogger(req.Context())
|
||||
logger.WithField("roomID", roomID).WithField("eventType", eventType).Info("Doing stuff...")
|
||||
return nil, &util.HTTPError{
|
||||
|
|
|
|||
Loading…
Reference in a new issue