aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-03-29 16:31:38 +0300
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-03-29 16:31:38 +0300
commiteca172369c00f16c32ac4acd2f8997a42c3e5b74 (patch)
tree7a891f154d2a16fd731916866b1813fcc70bdd75 /args.go
parentAdded delAllArgsBytes helper (diff)
downloadfasthttp-eca172369c00f16c32ac4acd2f8997a42c3e5b74.tar.gz
fasthttp-eca172369c00f16c32ac4acd2f8997a42c3e5b74.tar.bz2
fasthttp-eca172369c00f16c32ac4acd2f8997a42c3e5b74.zip
Pass string key to hasArg instead of byte slice key
Diffstat (limited to 'args.go')
-rw-r--r--args.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/args.go b/args.go
index 9b78488..281ee24 100644
--- a/args.go
+++ b/args.go
@@ -194,13 +194,12 @@ func (a *Args) PeekMultiBytes(key []byte) [][]byte {
// 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...)
- return a.HasBytes(a.bufKV.key)
+ return hasArg(a.args, key)
}
// HasBytes returns true if the given key exists in Args.
func (a *Args) HasBytes(key []byte) bool {
- return hasArg(a.args, key)
+ return hasArg(a.args, b2s(key))
}
// ErrNoArgValue is returned when Args value with the given key is missing.
@@ -342,10 +341,10 @@ func releaseArg(h []argsKV) []argsKV {
return h[:len(h)-1]
}
-func hasArg(h []argsKV, k []byte) bool {
+func hasArg(h []argsKV, key string) bool {
for i, n := 0, len(h); i < n; i++ {
kv := &h[i]
- if bytes.Equal(kv.key, k) {
+ if key == string(kv.key) {
return true
}
}