RenderComponent renders a component to the client. It sets the "Content-Type" header to "text/html; charset=utf-8". It reports any component render errors back to the caller. Look the Application.SetContextErrorHandler to override the default status code 500 with a custom error response.
(component Component)
| 4326 | // Look the Application.SetContextErrorHandler to override the |
| 4327 | // default status code 500 with a custom error response. |
| 4328 | func (ctx *Context) RenderComponent(component Component) error { |
| 4329 | ctx.ContentType("text/html; charset=utf-8") |
| 4330 | err := component.Render(ctx.Request().Context(), ctx.ResponseWriter()) |
| 4331 | if err != nil { |
| 4332 | ctx.handleContextError(err) |
| 4333 | } |
| 4334 | return err |
| 4335 | } |
| 4336 | |
| 4337 | // JSON marshals the given "v" value to JSON and writes the response to the client. |
| 4338 | // Look the Configuration.EnableProtoJSON and EnableEasyJSON too. |
no test coverage detected