From 7c0ab8b9741c0f63fc22be49a1026da52f4375a0 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 23 Nov 2023 21:19:26 +0800 Subject: Make CORS work for oauth2 handlers (#28184) Fix #25473 Although there was `m.Post("/login/oauth/access_token", CorsHandler()...`, it never really worked, because it still lacks the "OPTIONS" handler. --- routers/web/misc/misc.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'routers/web/misc') diff --git a/routers/web/misc/misc.go b/routers/web/misc/misc.go index 54c93763f6..e351994010 100644 --- a/routers/web/misc/misc.go +++ b/routers/web/misc/misc.go @@ -33,6 +33,10 @@ func DummyOK(w http.ResponseWriter, req *http.Request) { w.WriteHeader(http.StatusOK) } +func DummyBadRequest(w http.ResponseWriter, req *http.Request) { + w.WriteHeader(http.StatusBadRequest) +} + func RobotsTxt(w http.ResponseWriter, req *http.Request) { robotsTxt := util.FilePathJoinAbs(setting.CustomPath, "public/robots.txt") if ok, _ := util.IsExist(robotsTxt); !ok { -- cgit v1.2.3