RegisterHandlers 시그니쳐 변경
This commit is contained in:
11
server.go
11
server.go
@ -40,6 +40,13 @@ func init() {
|
||||
gob.Register([]any{})
|
||||
}
|
||||
|
||||
type ServerMuxInterface interface {
|
||||
http.Handler
|
||||
|
||||
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
|
||||
Handle(pattern string, handler http.Handler)
|
||||
}
|
||||
|
||||
const (
|
||||
// HTTPStatusReloginRequired : http status를 이걸 받으면 클라이언트는 로그아웃하고 로그인 화면으로 돌아가야 한다.
|
||||
HTTPStatusReloginRequired = 599
|
||||
@ -140,7 +147,7 @@ func isTlsEnabled(fileout ...*string) bool {
|
||||
}
|
||||
|
||||
// NewHTTPServer :
|
||||
func NewHTTPServerWithPort(serveMux *http.ServeMux, port int) *Server {
|
||||
func NewHTTPServerWithPort(serveMux ServerMuxInterface, port int) *Server {
|
||||
if isTlsEnabled() && port == 80 {
|
||||
port = 443
|
||||
}
|
||||
@ -157,7 +164,7 @@ func NewHTTPServerWithPort(serveMux *http.ServeMux, port int) *Server {
|
||||
return server
|
||||
}
|
||||
|
||||
func NewHTTPServer(serveMux *http.ServeMux) *Server {
|
||||
func NewHTTPServer(serveMux ServerMuxInterface) *Server {
|
||||
|
||||
// 시작시 자동으로 enable됨
|
||||
if isTlsEnabled() && *portptr == 80 {
|
||||
|
||||
Reference in New Issue
Block a user