diff options
author | Kegsay <kegan@matrix.org> | 2020-06-15 16:57:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 16:57:59 +0100 |
commit | 7c36fb78a729dcce174a5d1e577edeeeb9ca806d (patch) | |
tree | 0059b02850debc57f7d24658039b924d427f1434 /cmd/dendritejs/main.go | |
parent | 1aac3173410dbe5581f27b2f9104ef850fefa546 (diff) |
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
Diffstat (limited to 'cmd/dendritejs/main.go')
-rw-r--r-- | cmd/dendritejs/main.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go index 70672f4d..8c19eb6d 100644 --- a/cmd/dendritejs/main.go +++ b/cmd/dendritejs/main.go @@ -19,7 +19,6 @@ package main import ( "crypto/ed25519" "fmt" - "net/http" "syscall/js" "github.com/matrix-org/dendrite/appservice" @@ -233,7 +232,7 @@ func main() { monolith.AddAllPublicRoutes(base.PublicAPIMux) httputil.SetupHTTPAPI( - http.DefaultServeMux, + base.BaseMux, base.PublicAPIMux, base.InternalAPIMux, cfg, @@ -245,7 +244,7 @@ func main() { go func() { logrus.Info("Listening on libp2p-js host ID ", node.Id) s := JSServer{ - Mux: http.DefaultServeMux, + Mux: base.BaseMux, } s.ListenAndServe("p2p") }() @@ -255,7 +254,7 @@ func main() { go func() { logrus.Info("Listening for service-worker fetch traffic") s := JSServer{ - Mux: http.DefaultServeMux, + Mux: base.BaseMux, } s.ListenAndServe("fetch") }() |