Skip to content

Commit

Permalink
test: use ReplaceAll, remove unnecessary else (#1542)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Apr 25, 2023
1 parent cdea4fe commit 1aac293
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,17 +833,15 @@ func TestUseHostHeader2(t *testing.T) {
req.Header.SetHost("SomeHost")
if err := client.DoTimeout(req, resp, 1*time.Second); err != nil {
t.Fatalf("DoTimeout returned an error '%v'", err)
} else {
if resp.StatusCode() != http.StatusOK {
t.Fatalf("DoTimeout: %v", resp.body)
}
}
if resp.StatusCode() != http.StatusOK {
t.Fatalf("DoTimeout: %v", resp.body)
}
if err := client.Do(req, resp); err != nil {
t.Fatalf("DoTimeout returned an error '%v'", err)
} else {
if resp.StatusCode() != http.StatusOK {
t.Fatalf("Do: %q", resp.body)
}
}
if resp.StatusCode() != http.StatusOK {
t.Fatalf("Do: %q", resp.body)
}
}

Expand Down Expand Up @@ -2588,7 +2586,7 @@ func TestWriteMultipartForm(t *testing.T) {
t.Parallel()

var w bytes.Buffer
s := strings.Replace(`--foo
s := strings.ReplaceAll(`--foo
Content-Disposition: form-data; name="key"
value
Expand All @@ -2598,7 +2596,7 @@ Content-Type: application/json
{"foo": "bar"}
--foo--
`, "\n", "\r\n", -1)
`, "\n", "\r\n")
mr := multipart.NewReader(strings.NewReader(s), "foo")
form, err := mr.ReadForm(1024)
if err != nil {
Expand Down

0 comments on commit 1aac293

Please sign in to comment.