From af4175a5bcf9d6c4afdf355c9a3327b40a63a6a2 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Thu, 2 Feb 2023 19:07:16 -0500 Subject: [PATCH] Fix test, fix #598 --- server/server.go | 2 +- server/server_account_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index 64232abd..f538289d 100644 --- a/server/server.go +++ b/server/server.go @@ -400,7 +400,7 @@ func (s *Server) handleInternal(w http.ResponseWriter, r *http.Request, v *visit } else if (r.Method == http.MethodGet || r.Method == http.MethodHead) && fileRegex.MatchString(r.URL.Path) && s.config.AttachmentCacheDir != "" { return s.limitRequests(s.handleFile)(w, r, v) } else if r.Method == http.MethodOptions { - return s.ensureWebEnabled(s.handleOptions)(w, r, v) + return s.limitRequests(s.handleOptions)(w, r, v) // Should work even if the web app is not enabled, see #598 } else if (r.Method == http.MethodPut || r.Method == http.MethodPost) && r.URL.Path == "/" { return s.limitRequests(s.transformBodyJSON(s.authorizeTopicWrite(s.handlePublish)))(w, r, v) } else if r.Method == http.MethodPost && r.URL.Path == matrixPushPath { diff --git a/server/server_account_test.go b/server/server_account_test.go index a26bfc91..fb1cb406 100644 --- a/server/server_account_test.go +++ b/server/server_account_test.go @@ -263,7 +263,7 @@ func TestAccount_ChangePassword(t *testing.T) { "Authorization": util.BasicAuth("phil", "phil"), }) require.Equal(t, 400, rr.Code) - require.Equal(t, 40030, toHTTPError(t, rr.Body.String()).Code) + require.Equal(t, 40026, toHTTPError(t, rr.Body.String()).Code) rr = request(t, s, "POST", "/v1/account/password", `{"password": "phil", "new_password": "new password"}`, map[string]string{ "Authorization": util.BasicAuth("phil", "phil"), @@ -414,7 +414,7 @@ func TestAccount_Delete_Not_Allowed(t *testing.T) { "Authorization": util.BasicAuth("phil", "mypass"), }) require.Equal(t, 400, rr.Code) - require.Equal(t, 40030, toHTTPError(t, rr.Body.String()).Code) + require.Equal(t, 40026, toHTTPError(t, rr.Body.String()).Code) } func TestAccount_Reservation_AddWithoutTierFails(t *testing.T) {