MCPcopy
hub / github.com/labstack/echo / jsonPBlob

Method jsonPBlob

context.go:528–544  ·  view source on GitHub ↗
(code int, callback string, i any)

Source from the content-addressed store, hash-verified

526}
527
528func (c *Context) jsonPBlob(code int, callback string, i any) (err error) {
529 c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
530 c.response.WriteHeader(code)
531 if _, err = c.response.Write(stringToBytes(callback)); err != nil {
532 return
533 }
534 if _, err = c.response.Write(jsonpOpen); err != nil {
535 return
536 }
537 if err = c.echo.JSONSerializer.Serialize(c, i, ""); err != nil {
538 return
539 }
540 if _, err = c.response.Write(jsonpClose); err != nil {
541 return
542 }
543 return
544}
545
546func (c *Context) json(code int, i any, indent string) error {
547 c.writeContentType(MIMEApplicationJSON)

Callers 1

JSONPMethod · 0.95

Calls 5

writeContentTypeMethod · 0.95
stringToBytesFunction · 0.85
SerializeMethod · 0.65
WriteHeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected