diff options
author | 6543 <6543@obermui.de> | 2021-08-11 02:31:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 02:31:13 +0200 |
commit | c4d70a032564f610b7215d3d3973943abbc7395f (patch) | |
tree | 2aa8fe44a1b4d0251a18ae671509d4f2439ed85d /modules/context/context.go | |
parent | 2eeae4edb685b22e926d301465d771fe7a0b0c83 (diff) | |
download | gitea-c4d70a032564f610b7215d3d3973943abbc7395f.tar.gz gitea-c4d70a032564f610b7215d3d3973943abbc7395f.zip |
Rename ctx.Form() to ctx.FormString() and move code into own file (#16571)
Followup from #16562 prepare for #16567
* Rename ctx.Form() to ctx.FormString()
* Reimplement FormX func to need less code and cpu cycles
* Move code into own file
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index 041b81c668..3dbc2bb9dc 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -28,7 +28,6 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/templates" "code.gitea.io/gitea/modules/translation" - "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web/middleware" "code.gitea.io/gitea/services/auth" @@ -287,41 +286,6 @@ func (ctx *Context) Header() http.Header { return ctx.Resp.Header() } -// Form returns request form as string with default -func (ctx *Context) Form(key string, defaults ...string) string { - return (*Forms)(ctx.Req).MustString(key, defaults...) -} - -// FormTrim returns request form as string with default and trimmed spaces -func (ctx *Context) FormTrim(key string, defaults ...string) string { - return (*Forms)(ctx.Req).MustTrimmed(key, defaults...) -} - -// FormStrings returns request form as strings with default -func (ctx *Context) FormStrings(key string, defaults ...[]string) []string { - return (*Forms)(ctx.Req).MustStrings(key, defaults...) -} - -// FormInt returns request form as int with default -func (ctx *Context) FormInt(key string, defaults ...int) int { - return (*Forms)(ctx.Req).MustInt(key, defaults...) -} - -// FormInt64 returns request form as int64 with default -func (ctx *Context) FormInt64(key string, defaults ...int64) int64 { - return (*Forms)(ctx.Req).MustInt64(key, defaults...) -} - -// FormBool returns request form as bool with default -func (ctx *Context) FormBool(key string, defaults ...bool) bool { - return (*Forms)(ctx.Req).MustBool(key, defaults...) -} - -// FormOptionalBool returns request form as OptionalBool with default -func (ctx *Context) FormOptionalBool(key string, defaults ...util.OptionalBool) util.OptionalBool { - return (*Forms)(ctx.Req).MustOptionalBool(key, defaults...) -} - // HandleText handles HTTP status code func (ctx *Context) HandleText(status int, title string) { if (status/100 == 4) || (status/100 == 5) { |