summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers.go
diff options
context:
space:
mode:
authorWilczyƄskiT <102859171+WilczynskiT@users.noreply.github.com>2022-08-04 19:17:35 +0200
committerGitHub <noreply@github.com>2022-08-04 11:17:35 -0600
commit2642bd72b7ca35b8622824fdffced2aefe1aaf11 (patch)
tree3bc73bada610bfee6377eb58d89ca18b72236966 /modules/caddyhttp/matchers.go
parent17ae5acaba536e98cfa86ddcd6967801f1fa1bbe (diff)
Replace strings.Index usages with strings.Cut (#4930)
Diffstat (limited to 'modules/caddyhttp/matchers.go')
-rw-r--r--modules/caddyhttp/matchers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go
index 2eedaca..bb957d6 100644
--- a/modules/caddyhttp/matchers.go
+++ b/modules/caddyhttp/matchers.go
@@ -610,11 +610,11 @@ func (m *MatchQuery) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if query == "" {
continue
}
- parts := strings.SplitN(query, "=", 2)
- if len(parts) != 2 {
+ before, after, found := strings.Cut(query, "=")
+ if !found {
return d.Errf("malformed query matcher token: %s; must be in param=val format", d.Val())
}
- url.Values(*m).Add(parts[0], parts[1])
+ url.Values(*m).Add(before, after)
}
if d.NextBlock(0) {
return d.Err("malformed query matcher: blocks are not supported")