diff --git a/Changes b/Changes index 584e5c8..c36a4de 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ This file documents the revision history for check_nsc_web next: - minimum go version is now 1.22 + - silence "Unsolicited response received" messages 0.7.1 Wed Mar 13 20:30:41 CET 2024 - remove url parameters from error output diff --git a/pkg/checknscweb/check.go b/pkg/checknscweb/check.go index 5a2d70c..12f6201 100644 --- a/pkg/checknscweb/check.go +++ b/pkg/checknscweb/check.go @@ -225,8 +225,8 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { return 3 } - defer hClient.CloseIdleConnections() + log.SetOutput(io.Discard) // avoid "Unsolicited response received on idle HTTP channel starting with" messages req, err := buildRequest(ctx, output, queryURL.String(), flags) if err != nil { fmt.Fprintf(output, "UNKNOWN - %s", err.Error()) @@ -251,6 +251,7 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { return errorExit } + hClient.CloseIdleConnections() if flags.Verbose { dumpres, err2 := httputil.DumpResponse(res, true) @@ -261,7 +262,6 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { fmt.Fprintf(output, "<<<<<