Skip to content

Commit d0a903d

Browse files
committed
add some comments to FormString
1 parent e47fc94 commit d0a903d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

services/context/base_form.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
)
1313

1414
// FormString returns the first value matching the provided key in the form as a string
15+
// It works the same as http.Request.FormValue:
16+
// try urlencoded request body first, then query string, then multipart form body
1517
func (b *Base) FormString(key string, def ...string) string {
1618
s := b.Req.FormValue(key)
1719
if s == "" {
@@ -20,7 +22,7 @@ func (b *Base) FormString(key string, def ...string) string {
2022
return s
2123
}
2224

23-
// FormStrings returns a string slice for the provided key from the form
25+
// FormStrings returns a values for the key in the form (including query parameters), similar to FormString
2426
func (b *Base) FormStrings(key string) []string {
2527
if b.Req.Form == nil {
2628
if err := b.Req.ParseMultipartForm(32 << 20); err != nil {

0 commit comments

Comments
 (0)