mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
http: handle default mux (#2033)
This commit is contained in:
parent
655fe37188
commit
6eae1745bd
@ -12,6 +12,12 @@ import (
|
||||
// SupportPackageIsVersion1 These constants should not be referenced from any other code.
|
||||
const SupportPackageIsVersion1 = true
|
||||
|
||||
// Request type net/http.
|
||||
type Request = http.Request
|
||||
|
||||
// ResponseWriter type net/http.
|
||||
type ResponseWriter = http.ResponseWriter
|
||||
|
||||
// DecodeRequestFunc is decode request func.
|
||||
type DecodeRequestFunc func(*http.Request, interface{}) error
|
||||
|
||||
|
@ -149,6 +149,8 @@ func NewServer(opts ...ServerOption) *Server {
|
||||
o(srv)
|
||||
}
|
||||
srv.router = mux.NewRouter().StrictSlash(srv.strictSlash)
|
||||
srv.router.NotFoundHandler = http.DefaultServeMux
|
||||
srv.router.MethodNotAllowedHandler = http.DefaultServeMux
|
||||
srv.router.Use(srv.filter())
|
||||
srv.Server = &http.Server{
|
||||
Handler: FilterChain(srv.filters...)(srv.router),
|
||||
|
Loading…
x
Reference in New Issue
Block a user