Skip to content

Commit 4284483

Browse files
committed
fix(healthcheck): Parse arguments properly for httpheaders
1 parent eb21ef2 commit 4284483

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

parser/healthchecks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Options:
124124
the relative URL path for 'httpGet' probes. [default: /]
125125
--type=<type>
126126
the procType for which the health check needs to be applied.
127-
--header=<header>...
127+
--headers=<headers>...
128128
the HTTP headers to send for 'httpGet' probes, separated by commas.
129129
--initial-delay-timeout=<initial-delay-timeout>
130130
the initial delay timeout for the probe [default: 50]
@@ -154,7 +154,7 @@ Options:
154154
failureThreshold := safeGetInt(args, "--failure-threshold")
155155
headers := []string{}
156156
if args["--headers"] != nil {
157-
headers = args["--headers"].([]string)
157+
headers = strings.Split(args["--headers"].(string), ",")
158158
}
159159
if procType == "" {
160160
procType = defaultProcType
@@ -271,7 +271,7 @@ func parseHeader(header string) (*api.KVPair, error) {
271271
return nil, fmt.Errorf("could not find separator in header (%s)", header)
272272
}
273273
return &api.KVPair{
274-
Key: strings.TrimSpace(headerParts[0]),
274+
Name: strings.TrimSpace(headerParts[0]),
275275
Value: strings.TrimSpace(headerParts[1]),
276276
}, nil
277277
}

parser/healthchecks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestHealthchecks(t *testing.T) {
5151
expected: "",
5252
},
5353
{
54-
args: []string{"healthchecks:set", "liveness", "httpGet", "80", "--header=test-header:test-value"},
54+
args: []string{"healthchecks:set", "liveness", "httpGet", "80", "--headers=test-header:test-value"},
5555
expected: "",
5656
},
5757
{

0 commit comments

Comments
 (0)