MCPcopy Create free account
hub / github.com/kataras/iris / YAML

Method YAML

context/context.go:4624–4634  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

4622// Look the Application.SetContextErrorHandler to override the
4623// default status code 500 with a custom error response.
4624func (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.
4637func (ctx *Context) TextYAML(v interface{}) error {

Callers 5

NegotiateMethod · 0.95
mainFunction · 0.45
mainFunction · 0.45
setAllowedResponsesFunction · 0.45
defaultResultHandlerFunction · 0.45

Calls 2

ContentTypeMethod · 0.95
handleContextErrorMethod · 0.95

Tested by

no test coverage detected