YAML marshals the given "v" value using the yaml marshaler and writes the result to the client. It reports any YAML parser or write errors back to the caller. Look the Application.SetContextErrorHandler to override the default status code 500 with a custom error response.
(v interface{})
| 4622 | // Look the Application.SetContextErrorHandler to override the |
| 4623 | // default status code 500 with a custom error response. |
| 4624 | func (ctx *Context) YAML(v interface{}) error { |
| 4625 | ctx.ContentType(ContentYAMLHeaderValue) |
| 4626 | |
| 4627 | err := WriteYAML(ctx, v, 0) |
| 4628 | if err != nil { |
| 4629 | ctx.handleContextError(err) |
| 4630 | return err |
| 4631 | } |
| 4632 | |
| 4633 | return nil |
| 4634 | } |
| 4635 | |
| 4636 | // TextYAML calls the Context.YAML method but with the text/yaml content type instead. |
| 4637 | func (ctx *Context) TextYAML(v interface{}) error { |
no test coverage detected