MCPcopy
hub / github.com/gin-gonic/gin / HTML

Method HTML

context.go:1171–1174  ·  context.go::Context.HTML

HTML renders the HTTP template specified by its file name. It also updates the HTTP code and sets the Content-Type as "text/html". See http://golang.org/doc/articles/wiki/

(code int, name string, obj any)

Source from the content-addressed store, hash-verified

1169// It also updates the HTTP code and sets the Content-Type as "text/html".
1170// See http://golang.org/doc/articles/wiki/
1171func (c *Context) HTML(code int, name string, obj any) {
1172 instance := c.engine.HTMLRender.Instance(name, obj)
1173 c.Render(code, instance)
1174}
1175
1176// IndentedJSON serializes the given struct as pretty JSON (indented + endlines) into the response body.
1177// It also sets the Content-Type as "application/json".

Callers 6

NegotiateMethod · 0.95
TestContextRenderHTMLFunction · 0.80
TestContextRenderHTML2Function · 0.80
BenchmarkOneRouteHTMLFunction · 0.80
setupHTMLFilesFunction · 0.80

Calls 2

RenderMethod · 0.95
InstanceMethod · 0.65

Tested by 5

TestContextRenderHTMLFunction · 0.64
TestContextRenderHTML2Function · 0.64
BenchmarkOneRouteHTMLFunction · 0.64
setupHTMLFilesFunction · 0.64