Skip to content

Commit

Permalink
fix: some typo of docs of PostFormArray
Browse files Browse the repository at this point in the history
  • Loading branch information
snowykami committed Sep 5, 2024
1 parent af004b8 commit 8800a45
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ func (ctx *RequestContext) PostForm(key string) string {
return value
}

// PostFormArray returns the specified key from a POST urlencoded form or multipart form
// PostFormArray returns an array of the specified key from a POST urlencoded form or multipart form
// when it exists, otherwise it returns an empty array `([])`.
func (ctx *RequestContext) PostFormArray(key string) []string {
values, _ := ctx.GetPostFormArray(key)
Expand Down Expand Up @@ -1446,9 +1446,9 @@ func (ctx *RequestContext) GetPostForm(key string) (string, bool) {
//
// For example, during a PATCH request to update the item's tags:
//
// tag=tag1 tag=tag2 tag=tag3 --> (["tag1", "tag2", "tag3"], true) := GetPostFormArray("tags") // set tags to ["tag1", "tag2", "tag3"]
// tags= --> (nil, true) := GetPostFormArray("tags") // set tags to nil
// --> (nil, false) := GetPostFormArray("tags") // do nothing with tags
// tag=tag1 tag=tag2 tag=tag3 --> (["tag1", "tag2", "tag3"], true) := GetPostFormArray("tag") // set tag to ["tag1", "tag2", "tag3"]
// tag= --> (nil, true) := GetPostFormArray("tag") // set tags to nil
// --> (nil, false) := GetPostFormArray("tag") // do nothing with tags
func (ctx *RequestContext) GetPostFormArray(key string) ([]string, bool) {
vs := ctx.PostArgs().PeekAll(key)
values := make([]string, len(vs))
Expand Down

0 comments on commit 8800a45

Please sign in to comment.