ctrl := s.NewController("test") handleFunc = ctrl.HandleFunc(actName, handler, unmarshaler) }) BeforeEach(func() { handler = func(c *goa.Context) error { ctx = c c.RespondBytes(respStatus, respContent) return nil } unmarshaler = func(c *goa.Context) error { ctx = c req := c.Request() if req != nil { var payload interface{} err := ctx.Service().DecodeRequest(ctx, &payload) Ω(err).ShouldNot(HaveOccurred()) ctx.SetPayload(payload) } return nil } }) It("creates a handle", func() { Ω(handleFunc).ShouldNot(BeNil()) }) Context("with a request", func() { var rw http.ResponseWriter var r *http.Request var p url.Values
ctrl := s.NewController("test") handleFunc = ctrl.HandleFunc(actName, handler, unmarshaler) }) BeforeEach(func() { handler = func(c *goa.Context) error { ctx = c c.Respond(respStatus, respContent) return nil } unmarshaler = func(c *goa.Context) error { ctx = c req := c.Request() if req != nil { var payload interface{} err := ctx.Service().Decode(ctx, req.Body, &payload, req.Header.Get("Content-Type")) Ω(err).ShouldNot(HaveOccurred()) ctx.SetPayload(payload) } return nil } }) It("creates a handle", func() { Ω(handleFunc).ShouldNot(BeNil()) }) Context("with a request", func() { var rw http.ResponseWriter var r *http.Request var p url.Values