diff --git a/doc/example/pb/sum.pb.go b/doc/example/pb/sum.pb.go index 4a7565f..44d5732 100644 --- a/doc/example/pb/sum.pb.go +++ b/doc/example/pb/sum.pb.go @@ -38,7 +38,7 @@ func (m *SumRequest) Reset() { *m = SumRequest{} } func (m *SumRequest) String() string { return proto.CompactTextString(m) } func (*SumRequest) ProtoMessage() {} func (*SumRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_sum_cbdf98550256347c, []int{0} + return fileDescriptor_sum_f9b1650a56ecf8db, []int{0} } func (m *SumRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SumRequest.Unmarshal(m, b) @@ -84,7 +84,7 @@ func (m *SumResponse) Reset() { *m = SumResponse{} } func (m *SumResponse) String() string { return proto.CompactTextString(m) } func (*SumResponse) ProtoMessage() {} func (*SumResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_sum_cbdf98550256347c, []int{1} + return fileDescriptor_sum_f9b1650a56ecf8db, []int{1} } func (m *SumResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SumResponse.Unmarshal(m, b) @@ -195,9 +195,9 @@ var _Summator_serviceDesc = grpc.ServiceDesc{ Metadata: "sum.proto", } -func init() { proto.RegisterFile("sum.proto", fileDescriptor_sum_cbdf98550256347c) } +func init() { proto.RegisterFile("sum.proto", fileDescriptor_sum_f9b1650a56ecf8db) } -var fileDescriptor_sum_cbdf98550256347c = []byte{ +var fileDescriptor_sum_f9b1650a56ecf8db = []byte{ // 153 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8e, 0xb1, 0xce, 0x02, 0x21, 0x0c, 0x80, 0x7f, 0xfe, 0xcb, 0x19, 0xaf, 0x3a, 0x68, 0xe3, 0x70, 0x71, 0x32, 0x4c, 0x37, 0x31, diff --git a/doc/example/pb/sum.pb.goclay.go b/doc/example/pb/sum.pb.goclay.go index 4e04861..4391b2c 100644 --- a/doc/example/pb/sum.pb.goclay.go +++ b/doc/example/pb/sum.pb.goclay.go @@ -51,7 +51,7 @@ func (d *SummatorDesc) RegisterHTTP(mux transport.Router) { // Handlers for Sum - mux.MethodFunc(pattern_goclay_Summator_Sum_0, "GET", func(w http.ResponseWriter, r *http.Request) { + mux.MethodFunc("GET", pattern_goclay_Summator_Sum_0, func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() var req SumRequest @@ -166,6 +166,8 @@ var ( pattern_goclay_Summator_Sum_0 = "/v1/example/sum/{a}/{b}" unmarshaler_goclay_Summator_Sum_0 = func(r *http.Request, req *SumRequest) error { + var err error + rctx := chi.RouteContext(r.Context()) if rctx == nil { panic("Only chi router is supported for GETs atm") @@ -173,7 +175,7 @@ var ( for pos, k := range rctx.URLParams.Keys { runtime.PopulateFieldFromPath(req, k, rctx.URLParams.Values[pos]) } - return nil + return err } ) diff --git a/transport/handlers.go b/transport/handlers.go index 8a37fbe..ea9b291 100644 --- a/transport/handlers.go +++ b/transport/handlers.go @@ -23,8 +23,8 @@ type ServiceDesc interface { // Router routes HTTP requests around. type Router interface { http.Handler - Method(pattern string, method string, h http.Handler) - MethodFunc(pattern string, method string, h http.HandlerFunc) + Method(method string, pattern string, h http.Handler) + MethodFunc(method string, pattern string, h http.HandlerFunc) // Use makes this router use middlewares passed. Use(middlewares ...func(http.Handler) http.Handler) }