// unmarshalUpdateAccountPayload unmarshals the request body. func unmarshalUpdateAccountPayload(ctx *goa.Context) error { payload := &UpdateAccountPayload{} if err := ctx.Service().DecodeRequest(ctx, payload); err != nil { return err } if err := payload.Validate(); err != nil { return err } ctx.SetPayload(payload) return nil }
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