From 27fc6a382bca0f21d237c6b9e8cc83555bb01d31 Mon Sep 17 00:00:00 2001 From: Brady Dean <88594046+bradydean@users.noreply.github.com> Date: Mon, 6 May 2024 05:48:20 -0400 Subject: [PATCH] docs(echo): set headers before calling WriteHeader (#729) --- examples/integration-echo/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/integration-echo/main.go b/examples/integration-echo/main.go index 506f90bbb..8c832b3e1 100644 --- a/examples/integration-echo/main.go +++ b/examples/integration-echo/main.go @@ -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) }