Skip to content

Commit

Permalink
Clean up integration_tests/backend_helpers.go.
Browse files Browse the repository at this point in the history
  • Loading branch information
sengi committed Jan 21, 2024
1 parent 6e8e6da commit 015a353
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions integration_tests/backend_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,14 @@ func startTarpitBackend(delays ...time.Duration) *httptest.Server {
bodyDelay = delays[1]
}
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body := "Tarpit\n"
const body = "Tarpit\n"

if responseDelay > 0 {
time.Sleep(responseDelay)
}
time.Sleep(responseDelay)
w.Header().Add("Content-Length", strconv.Itoa(len(body)))
w.WriteHeader(http.StatusOK)
w.(http.Flusher).Flush()

if bodyDelay > 0 {
time.Sleep(bodyDelay)
}
time.Sleep(bodyDelay)
_, err := w.Write([]byte(body))
Expect(err).NotTo(HaveOccurred())
}))
Expand Down

0 comments on commit 015a353

Please sign in to comment.