## Pull Request template Please, go through these steps before clicking submit on this PR. 1. Give a descriptive title to your PR. 2. Provide a description of your changes. 3. Make sure you have some relevant tests. 4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). **PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING** Reviewed-on: #197 Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru> Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit was merged in pull request #197.
	This commit is contained in:
		| @@ -172,7 +172,7 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) | |||||||
| 						hdlr := shdlr.(*httpHandler) | 						hdlr := shdlr.(*httpHandler) | ||||||
| 						fh, mp, err := hdlr.handlers.Search(http.MethodPost, "/"+microMethod) | 						fh, mp, err := hdlr.handlers.Search(http.MethodPost, "/"+microMethod) | ||||||
| 						if err == nil { | 						if err == nil { | ||||||
| 							match = true | 							// match = true | ||||||
| 							for k, v := range mp { | 							for k, v := range mp { | ||||||
| 								matches[k] = v | 								matches[k] = v | ||||||
| 							} | 							} | ||||||
| @@ -278,7 +278,7 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// wrap the handler func | 		// wrap the handler func | ||||||
| 		h.opts.Hooks.EachNext(func(hook options.Hook) { | 		h.opts.Hooks.EachPrev(func(hook options.Hook) { | ||||||
| 			if h, ok := hook.(server.HookHandler); ok { | 			if h, ok := hook.(server.HookHandler); ok { | ||||||
| 				fn = h(fn) | 				fn = h(fn) | ||||||
| 			} | 			} | ||||||
| @@ -589,6 +589,7 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||||||
| 	if r.Body != nil { | 	if r.Body != nil { | ||||||
| 		var buf []byte | 		var buf []byte | ||||||
| 		buf, err = io.ReadAll(r.Body) | 		buf, err = io.ReadAll(r.Body) | ||||||
|  | 		r.Body.Close() | ||||||
| 		if err != nil && err != io.EOF { | 		if err != nil && err != io.EOF { | ||||||
| 			h.errorHandler(ctx, handler, w, r, err, http.StatusInternalServerError) | 			h.errorHandler(ctx, handler, w, r, err, http.StatusInternalServerError) | ||||||
| 			return | 			return | ||||||
| @@ -645,7 +646,7 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	h.opts.Hooks.EachNext(func(hook options.Hook) { | 	h.opts.Hooks.EachPrev(func(hook options.Hook) { | ||||||
| 		if h, ok := hook.(server.HookHandler); ok { | 		if h, ok := hook.(server.HookHandler); ok { | ||||||
| 			fn = h(fn) | 			fn = h(fn) | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -1,8 +1,6 @@ | |||||||
| package http | package http | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"io" |  | ||||||
|  |  | ||||||
| 	"go.unistack.org/micro/v3/codec" | 	"go.unistack.org/micro/v3/codec" | ||||||
| 	"go.unistack.org/micro/v3/metadata" | 	"go.unistack.org/micro/v3/metadata" | ||||||
| 	"go.unistack.org/micro/v3/server" | 	"go.unistack.org/micro/v3/server" | ||||||
| @@ -14,7 +12,7 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| type rpcRequest struct { | type rpcRequest struct { | ||||||
| 	rw          io.ReadWriter | 	// rw          io.ReadWriter | ||||||
| 	payload     interface{} | 	payload     interface{} | ||||||
| 	codec       codec.Codec | 	codec       codec.Codec | ||||||
| 	header      metadata.Metadata | 	header      metadata.Metadata | ||||||
|   | |||||||
| @@ -152,7 +152,7 @@ func (s *Server) createSubHandler(sb *httpSubscriber, opts server.Options) broke | |||||||
| 				return nil | 				return nil | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			opts.Hooks.EachNext(func(hook options.Hook) { | 			opts.Hooks.EachPrev(func(hook options.Hook) { | ||||||
| 				if h, ok := hook.(server.HookSubHandler); ok { | 				if h, ok := hook.(server.HookSubHandler); ok { | ||||||
| 					fn = h(fn) | 					fn = h(fn) | ||||||
| 				} | 				} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user