summaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/staticresp.go
diff options
context:
space:
mode:
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 9e12bd5cc..f0aea0307 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