diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-11-23 21:19:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-23 21:19:26 +0800 |
commit | 7c0ab8b9741c0f63fc22be49a1026da52f4375a0 (patch) | |
tree | 3e95f426fdc219b2a7f2c490fe32b70b30db14b8 /modules | |
parent | 778d6043464d60e06af183ae24d764bf3e9fce0f (diff) | |
download | gitea-7c0ab8b9741c0f63fc22be49a1026da52f4375a0.tar.gz gitea-7c0ab8b9741c0f63fc22be49a1026da52f4375a0.zip |
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.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/web/route.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/web/route.go b/modules/web/route.go index c24c8f4d67..86b83dd723 100644 --- a/modules/web/route.go +++ b/modules/web/route.go @@ -136,6 +136,10 @@ func (r *Route) Get(pattern string, h ...any) { r.Methods("GET", pattern, h...) } +func (r *Route) Options(pattern string, h ...any) { + r.Methods("OPTIONS", pattern, h...) +} + // GetOptions delegate get and options method func (r *Route) GetOptions(pattern string, h ...any) { r.Methods("GET,OPTIONS", pattern, h...) |