Closed tibers closed 1 year ago
Try change the result in design.go from Result(Int)
to
Result(func() {
Attribute("result", Int)
Required("result")
})
Regenerate (goa gen calcsvc/design)
Change calc.go to
func (s *calcsrvc) Multiply(ctx context.Context, p *calc.MultiplyPayload) (res *calc.MultiplyResult, err error) {
return &calc.MultiplyResult{Result: p.A * p.B}, nil
}
Build and run, switching the accept header from "application/json" to "application/xml" will now work as expected.
oh thank you very much! I would humbly suggest updating the tutorial because I felt it was some problem in the Body. :)
@tibers Yeah we could change the tutorial :) Would you mind giving it a shot?
Gonna write some readme!
The update looks great, thank you!
I'm working through the example documentation and I expected
accept
to work.On the face of it, not bad. But backstage expects JSON if it sends the accept header and I expected the output to be something along the lines of
{ "Result": "10" }
. (Or even the name of the route...)Peeking at the
-debug
output I can even see it notices theaccept:
bit...Is there a graceful way of handling this that just isn't apparent to me?