From 1183c1ca8fd78a3e1fae4f16224d6d62d91b1cdb Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 26 Jan 2016 19:28:41 +0100 Subject: [PATCH] Fixed recovery unit tests --- recovery.go | 2 +- recovery_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/recovery.go b/recovery.go index 50a73b6a..67c504c5 100644 --- a/recovery.go +++ b/recovery.go @@ -37,7 +37,7 @@ func RecoveryWithWriter(out io.Writer) HandlerFunc { if logger != nil { stack := stack(3) httprequest, _ := httputil.DumpRequest(c.Request, false) - logger.Printf("[Recovery] panic recovered:\n%s\n%s\n%s %s", string(httprequest), err, stack, reset) + logger.Printf("[Recovery] panic recovered:\n%s\n%s\n%s%s", string(httprequest), err, stack, reset) } c.AbortWithStatus(500) } diff --git a/recovery_test.go b/recovery_test.go index 39e71e81..94c71a11 100644 --- a/recovery_test.go +++ b/recovery_test.go @@ -23,7 +23,8 @@ func TestPanicInHandler(t *testing.T) { w := performRequest(router, "GET", "/recovery") // TEST assert.Equal(t, w.Code, 500) - assert.Contains(t, buffer.String(), "Panic recovery -> Oupps, Houston, we have a problem") + assert.Contains(t, buffer.String(), "GET /recovery") + assert.Contains(t, buffer.String(), "Oupps, Houston, we have a problem") assert.Contains(t, buffer.String(), "TestPanicInHandler") }