feat: add http header handler (#1461)

pull/1462/head
letian 3 years ago committed by GitHub
parent ab5152dbe1
commit 4bdafa6393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      transport/http/server.go

@ -168,6 +168,11 @@ func (s *Server) HandleFunc(path string, h http.HandlerFunc) {
s.router.HandleFunc(path, h)
}
// HandleHeader registers a new route with a matcher for the header.
func (s *Server) HandleHeader(key, val string, h http.HandlerFunc) {
s.router.Headers(key, val).Handler(h)
}
// ServeHTTP should write reply headers and data to the ResponseWriter and then return.
func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
s.Handler.ServeHTTP(res, req)

Loading…
Cancel
Save