Render writes the response headers and calls the given renderer "r" to render data. This method can be used while migrating from other frameworks.
(statusCode int, r interface {
// Render should push data with custom content type to the client.
Render(http.ResponseWriter) error
// WriteContentType writes custom content type to the response.
WriteContentType(w http.ResponseWriter)
})
| 4295 | // Render writes the response headers and calls the given renderer "r" to render data. |
| 4296 | // This method can be used while migrating from other frameworks. |
| 4297 | func (ctx *Context) Render(statusCode int, r interface { |
| 4298 | // Render should push data with custom content type to the client. |
| 4299 | Render(http.ResponseWriter) error |
| 4300 | // WriteContentType writes custom content type to the response. |
| 4301 | WriteContentType(w http.ResponseWriter) |
| 4302 | }) { |
| 4303 | ctx.StatusCode(statusCode) |
| 4304 | |
| 4305 | if statusCode >= 100 && statusCode <= 199 || statusCode == http.StatusNoContent || statusCode == http.StatusNotModified { |
| 4306 | r.WriteContentType(ctx.writer) |
| 4307 | return |
| 4308 | } |
| 4309 | |
| 4310 | if err := r.Render(ctx.writer); err != nil { |
| 4311 | ctx.StopWithError(http.StatusInternalServerError, err) |
| 4312 | } |
| 4313 | } |
| 4314 | |
| 4315 | // Component is the interface which all components must implement. |
| 4316 | // A component is a struct which can be rendered to a writer. |
nothing calls this directly
no test coverage detected