Skip to content

Commit

Permalink
docs(echo): set headers before calling WriteHeader (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradydean authored May 6, 2024
1 parent 89f216e commit 27fc6a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/integration-echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func main() {

// This custom Render replaces Echo's echo.Context.Render() with templ's templ.Component.Render().
func Render(ctx echo.Context, statusCode int, t templ.Component) error {
ctx.Response().Writer.WriteHeader(statusCode)
ctx.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
ctx.Response().Writer.WriteHeader(statusCode)
return t.Render(ctx.Request().Context(), ctx.Response().Writer)
}

Expand Down

0 comments on commit 27fc6a3

Please sign in to comment.