Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir20 committed Mar 13, 2024
1 parent d3e3529 commit 57009e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testhelper/httptest/httptest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestServer(t *testing.T) {

func TestUnStartedServer(t *testing.T) {
// create a server which is not started
httpUnStartedServer := kithttptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
httpUnStartedServer := kithttptest.NewUnStartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte("Hello, world!"))
}))

Expand All @@ -55,7 +55,7 @@ func TestUnStartedServer(t *testing.T) {
statusCode int
)
require.Never(t, func() bool {
resp, err := http.Get(httpUnStartedServer.URL)
resp, err := http.Get("http://" + httpUnStartedServer.Listener.Addr().String())
defer func() { httputil.CloseResponse(resp) }()
if err == nil {
statusCode = resp.StatusCode
Expand Down

0 comments on commit 57009e2

Please sign in to comment.