diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-07-29 09:42:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 03:42:15 +0200 |
commit | 33e0b38287fdc3487112062300b8dd3c95415ee7 (patch) | |
tree | 603394d8f303de1031c21da0d3d3a3cdc0b2bfda /modules/context/context.go | |
parent | 370516883717de0e6e2087c12d368eb1465ee3b0 (diff) | |
download | gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.tar.gz gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.zip |
Rename context.Query to context.Form (#16562)
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index 6973f0dddc..b356e1eb1b 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -287,41 +287,38 @@ func (ctx *Context) Header() http.Header { return ctx.Resp.Header() } -// FIXME: We should differ Query and Form, currently we just use form as query -// Currently to be compatible with macaron, we keep it. - -// Query returns request form as string with default -func (ctx *Context) Query(key string, defaults ...string) string { +// Form returns request form as string with default +func (ctx *Context) Form(key string, defaults ...string) string { return (*Forms)(ctx.Req).MustString(key, defaults...) } -// QueryTrim returns request form as string with default and trimmed spaces -func (ctx *Context) QueryTrim(key string, defaults ...string) string { +// 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...) } -// QueryStrings returns request form as strings with default -func (ctx *Context) QueryStrings(key string, defaults ...[]string) []string { +// FormStrings returns request form as strings with default +func (ctx *Context) FormStrings(key string, defaults ...[]string) []string { return (*Forms)(ctx.Req).MustStrings(key, defaults...) } -// QueryInt returns request form as int with default -func (ctx *Context) QueryInt(key string, defaults ...int) int { +// FormInt returns request form as int with default +func (ctx *Context) FormInt(key string, defaults ...int) int { return (*Forms)(ctx.Req).MustInt(key, defaults...) } -// QueryInt64 returns request form as int64 with default -func (ctx *Context) QueryInt64(key string, defaults ...int64) int64 { +// FormInt64 returns request form as int64 with default +func (ctx *Context) FormInt64(key string, defaults ...int64) int64 { return (*Forms)(ctx.Req).MustInt64(key, defaults...) } -// QueryBool returns request form as bool with default -func (ctx *Context) QueryBool(key string, defaults ...bool) bool { +// FormBool returns request form as bool with default +func (ctx *Context) FormBool(key string, defaults ...bool) bool { return (*Forms)(ctx.Req).MustBool(key, defaults...) } -// QueryOptionalBool returns request form as OptionalBool with default -func (ctx *Context) QueryOptionalBool(key string, defaults ...util.OptionalBool) util.OptionalBool { +// 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...) } |