mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Fix rooms v3 url paths for good - with tests (#1130)
* Fix rooms v3 url paths for good - with tests - Add a test rig around `federationapi` to test routing. - Use `JSONVerifier` over `KeyRing` so we can stub things out more easily. - Add `test.NopJSONVerifier` which verifies nothing. - Add `base.BaseMux` which is the original `mux.Router` used to spawn public/internal routers. - Listen on `base.BaseMux` and not the default serve mux as it cleans paths which we don't want. - Factor out `ListenAndServe` to `test.ListenAndServe` and add flag for listening on TLS. * Fix comments * Linting
This commit is contained in:
parent
1aac317341
commit
7c36fb78a7
19 changed files with 228 additions and 76 deletions
|
@ -47,6 +47,7 @@ var (
|
|||
userID = flag.String("user-id", "@userid:$SERVER_NAME", "The user ID to use as the event sender")
|
||||
messageCount = flag.Int("message-count", 10, "The number of m.room.messsage events to generate")
|
||||
format = flag.String("Format", "InputRoomEvent", "The output format to use for the messages: InputRoomEvent or Event")
|
||||
ver = flag.String("version", string(gomatrixserverlib.RoomVersionV1), "Room version to generate events as")
|
||||
)
|
||||
|
||||
// By default we use a private key of 0.
|
||||
|
@ -109,7 +110,7 @@ func buildAndOutput() gomatrixserverlib.EventReference {
|
|||
|
||||
event, err := b.Build(
|
||||
now, name, key, privateKey,
|
||||
gomatrixserverlib.RoomVersionV1,
|
||||
gomatrixserverlib.RoomVersion(*ver),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -127,7 +128,7 @@ func writeEvent(event gomatrixserverlib.Event) {
|
|||
if *format == "InputRoomEvent" {
|
||||
var ire api.InputRoomEvent
|
||||
ire.Kind = api.KindNew
|
||||
ire.Event = event.Headered(gomatrixserverlib.RoomVersionV1)
|
||||
ire.Event = event.Headered(gomatrixserverlib.RoomVersion(*ver))
|
||||
authEventIDs := []string{}
|
||||
for _, ref := range b.AuthEvents.([]gomatrixserverlib.EventReference) {
|
||||
authEventIDs = append(authEventIDs, ref.EventID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue