Clarify that POST publicRooms is implemented (#743)

As a response to #638, it seems that POST /publicRooms is already implemented. It is, however, unclear from the code that it is.

Add some comments and change a method name to make this more clear.
main
Andrew Morgan 2019-07-18 17:21:06 +01:00 committed by Alex Chen
parent e56d6e41fd
commit 6ff7b6a72a
2 changed files with 3 additions and 3 deletions

View File

@ -42,8 +42,8 @@ type publicRoomRes struct {
Estimate int64 `json:"total_room_count_estimate,omitempty"` Estimate int64 `json:"total_room_count_estimate,omitempty"`
} }
// GetPublicRooms implements GET /publicRooms // GetPostPublicRooms implements GET and POST /publicRooms
func GetPublicRooms( func GetPostPublicRooms(
req *http.Request, publicRoomDatabase *storage.PublicRoomsServerDatabase, req *http.Request, publicRoomDatabase *storage.PublicRoomsServerDatabase,
) util.JSONResponse { ) util.JSONResponse {
var limit int16 var limit int16

View File

@ -64,7 +64,7 @@ func Setup(apiMux *mux.Router, deviceDB *devices.Database, publicRoomsDB *storag
).Methods(http.MethodPut, http.MethodOptions) ).Methods(http.MethodPut, http.MethodOptions)
r0mux.Handle("/publicRooms", r0mux.Handle("/publicRooms",
common.MakeExternalAPI("public_rooms", func(req *http.Request) util.JSONResponse { common.MakeExternalAPI("public_rooms", func(req *http.Request) util.JSONResponse {
return directory.GetPublicRooms(req, publicRoomsDB) return directory.GetPostPublicRooms(req, publicRoomsDB)
}), }),
).Methods(http.MethodGet, http.MethodPost, http.MethodOptions) ).Methods(http.MethodGet, http.MethodPost, http.MethodOptions)
} }