mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename context.Query to context.Form (#16562)
This commit is contained in:
@@ -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...)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user