1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-07 23:02:12 +02:00

fix middleware errors (#717)

This commit is contained in:
Tony Chen 2021-02-23 14:38:37 +08:00 committed by GitHub
parent ef996c826a
commit 1fd1332c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,9 @@ func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
if s.middleware != nil {
h = s.middleware(h)
}
h(ctx, req.WithContext(ctx))
if _, err := h(ctx, req.WithContext(ctx)); err != nil {
s.errorEncoder(res, req, err)
}
}
// Endpoint return a real address to registry endpoint.