Skip to content

Commit

Permalink
http_test: simplify strings.Index with strings.Contains
Browse files Browse the repository at this point in the history
Both have the same O(n), but strings.Contains more readable on
if-condition.
  • Loading branch information
shuLhan committed Jan 30, 2019
1 parent 8439088 commit cf6c51e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func TestRequestUpdateURI(t *testing.T) {
if !strings.HasPrefix(s, "GET /123/432.html?aaa=bcse") {
t.Fatalf("cannot find %q in %q", "GET /123/432.html?aaa=bcse", s)
}
if strings.Index(s, "\r\nHost: foobar.com\r\n") < 0 {
if !strings.Contains(s, "\r\nHost: foobar.com\r\n") {
t.Fatalf("cannot find %q in %q", "\r\nHost: foobar.com\r\n", s)
}
}
Expand Down

0 comments on commit cf6c51e

Please sign in to comment.