fix nil ptr #184

Merged
vtolstov merged 2 commits from devstigneev/micro-server-http:issue_179_v3 into v3 2024-03-12 22:05:33 +03:00
Showing only changes of commit 5e6bd93a6b - Show all commits

View File

@ -562,6 +562,8 @@ func (h *Server) Start() error {
var ok bool var ok bool
if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil { if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil {
hs.Handler = fn hs.Handler = fn
} else {
hs = &http.Server{Handler: fn}
} }
} }