mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 04:57:07 +08:00
Merge e234c86fc5d6b30e914c323a1de23b410d8118c5 into 66fa43f9aea4ecf627f269b43ddad59f206f9b75
This commit is contained in:
commit
c39492506f
4
gin.go
4
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
|
||||
}
|
||||
|
||||
|
10
gin_test.go
10
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user