diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-02-15 14:01:22 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-02-15 14:01:22 +0200 |
commit | db0b8124a5b5a5671ec67eef75e4288461f5d0c9 (patch) | |
tree | 9de71ad3a9d28b0ba0810383f07ad4953a67384e /args.go | |
parent | Do not copy body stream in Request.CopyTo to be consistent with Response.CopyTo (diff) | |
download | fasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.tar.gz fasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.tar.bz2 fasthttp-db0b8124a5b5a5671ec67eef75e4288461f5d0c9.zip |
Added Args.PeekMulti for obtaining multiple query arg values for the given key
Diffstat (limited to 'args.go')
-rw-r--r-- | args.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -156,6 +156,22 @@ func (a *Args) PeekBytes(key []byte) []byte { return peekArgBytes(a.args, key) } +// PeekMulti returns all the arg values for the given key. +func (a *Args) PeekMulti(key string) [][]byte { + var values [][]byte + a.VisitAll(func(k, v []byte) { + if string(k) == key { + values = append(values, v) + } + }) + return values +} + +// PeekMultiBytes returns all the arg values for the given key. +func (a *Args) PeekMultiBytes(key []byte) [][]byte { + return a.PeekMulti(unsafeBytesToStr(key)) +} + // Has returns true if the given key exists in Args. func (a *Args) Has(key string) bool { a.bufKV.key = append(a.bufKV.key[:0], key...) |