From e234c86fc5d6b30e914c323a1de23b410d8118c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20J=C3=BCttner?= Date: Fri, 29 May 2015 18:59:33 +0200 Subject: [PATCH] Fix RunTLS --- gin.go | 4 ++-- gin_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gin.go b/gin.go index 570ac83a..a47372a2 100644 --- a/gin.go +++ b/gin.go @@ -171,11 +171,11 @@ func (engine *Engine) Run(addr string) (err error) { return } -func (engine *Engine) RunTLS(addr string, cert string, key string) (err error) { +func (engine *Engine) RunTLS(addr string, certFile string, keyFile string) (err error) { debugPrint("Listening and serving HTTPS on %s\n", addr) defer func() { debugPrintError(err) }() - err = http.ListenAndServe(addr, engine) + err = http.ListenAndServeTLS(addr, certFile, keyFile, engine) return } diff --git a/gin_test.go b/gin_test.go index 03107dd4..4984bcaf 100644 --- a/gin_test.go +++ b/gin_test.go @@ -148,3 +148,13 @@ func TestNoMethodWithGlobalHandlers(t *testing.T) { assert.Equal(t, router.allNoMethod[1], middleware1) assert.Equal(t, router.allNoMethod[2], middleware0) } + +func TestRunTLS(t *testing.T) { + certFile := "" + keyFile := "" + addr := ":5443" + router := New() + + err := router.RunTLS(addr, certFile, keyFile) + assert.NotNil(t, err) +}