summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/staticresp.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-08-02 16:39:09 -0400
committerGitHub <noreply@github.com>2022-08-02 16:39:09 -0400
commit141872ed80d6323505e7543628c259fdae8506d3 (patch)
tree53581cddf2fcce189c3a55019194b64b0cd3af13 /modules/caddyhttp/staticresp.go
parentdb1aa5b5bc174e5a5df39a277f737b304e1e2350 (diff)
chore: Bump up to Go 1.19, minimum 1.18 (#4925)
Diffstat (limited to 'modules/caddyhttp/staticresp.go')
-rw-r--r--modules/caddyhttp/staticresp.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/modules/caddyhttp/staticresp.go b/modules/caddyhttp/staticresp.go
index 9e12bd5..f0aea03 100644
--- a/modules/caddyhttp/staticresp.go
+++ b/modules/caddyhttp/staticresp.go
@@ -283,7 +283,7 @@ func cmdRespond(fl caddycmd.Flags) (int, error) {
// build headers map
hdr := make(http.Header)
for i, h := range respondCmdHeaders {
- key, val, found := cut(h, ":") // TODO: use strings.Cut() once Go 1.18 is our minimum
+ key, val, found := strings.Cut(h, ":")
key, val = strings.TrimSpace(key), strings.TrimSpace(val)
if !found || key == "" || val == "" {
return caddy.ExitCodeFailedStartup, fmt.Errorf("header %d: invalid format \"%s\" (expecting \"Field: value\")", i, h)
@@ -395,14 +395,6 @@ func cmdRespond(fl caddycmd.Flags) (int, error) {
select {}
}
-// TODO: delete this and use strings.Cut() once Go 1.18 is our minimum
-func cut(s, sep string) (before, after string, found bool) {
- if i := strings.Index(s, sep); i >= 0 {
- return s[:i], s[i+len(sep):], true
- }
- return s, "", false
-}
-
// respondCmdHeaders holds the parsed values from repeated use of the --header flag.
var respondCmdHeaders caddycmd.StringSlice