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

Method JSONP

context/context.go:4409–4425  ·  view source on GitHub ↗

JSONP marshals the given "v" value to JSON and sends the response to the client. It reports any JSON 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{}, opts ...JSONP)

Source from the content-addressed store, hash-verified

4407// Look the Application.SetContextErrorHandler to override the
4408// default status code 500 with a custom error response.
4409func (ctx *Context) JSONP(v interface{}, opts ...JSONP) (err error) {
4410 var options *JSONP
4411 if len(opts) > 0 {
4412 options = &opts[0]
4413 } else {
4414 options = &DefaultJSONPOptions
4415 }
4416
4417 ctx.ContentType(ContentJavascriptHeaderValue)
4418 if err = WriteJSONP(ctx, v, options); err != nil {
4419 if !options.OmitErrorHandler {
4420 ctx.handleContextError(err)
4421 }
4422 }
4423
4424 return
4425}
4426
4427type xmlMapEntry struct {
4428 XMLName xml.Name

Callers 2

NegotiateMethod · 0.95
mainFunction · 0.45

Calls 2

ContentTypeMethod · 0.95
handleContextErrorMethod · 0.95

Tested by

no test coverage detected