Exemplo n.º 1
0
// 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
}
Exemplo n.º 2
0
		})

		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

			BeforeEach(func() {