diff --git a/transport/http/server.go b/transport/http/server.go index 8744ef420..80f99935d 100644 --- a/transport/http/server.go +++ b/transport/http/server.go @@ -2,6 +2,7 @@ package http import ( "context" + "errors" "fmt" "net" "net/http" @@ -152,7 +153,10 @@ func (s *Server) Start() error { } s.lis = lis s.log.Infof("[HTTP] server listening on: %s", lis.Addr().String()) - return s.Serve(lis) + if err := s.Serve(lis); !errors.Is(err, http.ErrServerClosed) { + return err + } + return nil } // Stop stop the HTTP server. diff --git a/transport/http/server_test.go b/transport/http/server_test.go index d8a2671d7..06dbb3111 100644 --- a/transport/http/server_test.go +++ b/transport/http/server_test.go @@ -3,7 +3,6 @@ package http import ( "context" "encoding/json" - "errors" "fmt" "net/http" "testing" @@ -38,7 +37,7 @@ func TestServer(t *testing.T) { testClient(t, srv) }) - if err := srv.Start(); !errors.Is(err, http.ErrServerClosed) { + if err := srv.Start(); err != nil { t.Fatal(err) } } diff --git a/transport/http/service_test.go b/transport/http/service_test.go index d263249d1..6d2440e20 100644 --- a/transport/http/service_test.go +++ b/transport/http/service_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "net/http" "testing" @@ -61,7 +60,7 @@ func TestService(t *testing.T) { testServiceClient(t, srv) }) - if err := srv.Start(); !errors.Is(err, http.ErrServerClosed) { + if err := srv.Start(); err != nil { t.Fatal(err) } }