Skip to content
Snippets Groups Projects
Commit 94a15e44 authored by wangguoliang's avatar wangguoliang Committed by Alex Ellis
Browse files

should use strings.Contains() instead of stings.Index()


Signed-off-by: default avatarwgliang <liangcszzu@163.com>
parent 622b2426
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ func MakeFunctionReader(metricsOptions metrics.MetricOptions, c *client.Client)
var envProcess string
for _, env := range service.Spec.TaskTemplate.ContainerSpec.Env {
if strings.Index(env, "fprocess=") > -1 {
if strings.Contains(env, "fprocess=") {
envProcess = env[len("fprocess="):]
}
}
......
......@@ -47,7 +47,7 @@ func TestHandler_HasCustomHeaderInFunction_WithCgi_Mode(t *testing.T) {
read, _ := ioutil.ReadAll(rr.Body)
val := string(read)
if strings.Index(val, "Http_Custom_Header") == -1 {
if !strings.Contains(val, "Http_Custom_Header") {
t.Errorf("'env' should printed: Http_Custom_Header, got: %s\n", val)
}
......@@ -83,7 +83,7 @@ func TestHandler_DoesntHaveCustomHeaderInFunction_WithoutCgi_Mode(t *testing.T)
read, _ := ioutil.ReadAll(rr.Body)
val := string(read)
if strings.Index(val, "Http_Custom_Header") != -1 {
if strings.Contains(val, "Http_Custom_Header") {
t.Errorf("'env' should not have printed: Http_Custom_Header, got: %s\n", val)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment