Make it possible to point Riot at Dendrite (#74)

This commit is contained in:
Kegsay 2017-04-20 17:11:53 +01:00 committed by GitHub
parent 43d1e94e75
commit 2fadb9e409
4 changed files with 165 additions and 1 deletions

2
vendor/manifest vendored
View file

@ -98,7 +98,7 @@
{
"importpath": "github.com/matrix-org/util",
"repository": "https://github.com/matrix-org/util",
"revision": "ec8896cd7d9ba6de6143c5f123d1e45413657e7d",
"revision": "bc9d5e2d2f68a2ca279fce0fa2f28a91ecf301ed",
"branch": "master"
},
{

View file

@ -111,6 +111,11 @@ func MakeJSONAPI(handler JSONRequestHandler) http.HandlerFunc {
logger := GetLogger(req.Context())
logger.Print("Incoming request")
if req.Method == "OPTIONS" {
SetCORSHeaders(w)
w.WriteHeader(200)
return
}
res := handler.OnIncomingRequest(req)
// Set common headers returned regardless of the outcome of the request