diff --git a/serve.go b/serve.go index d025409f..e8cad04e 100644 --- a/serve.go +++ b/serve.go @@ -61,7 +61,7 @@ func (s *Server) url() string { // initializes any Context type with the base ContextNoBody context. // // var ctx ContextWithBody[any] // does not work because it will create a ContextWithBody[any] with a nil value -func InitContext[Contextable ctxWithBody[Body], Body any](baseContext ContextNoBody) (Contextable, error) { +func initContext[Contextable ctxWithBody[Body], Body any](baseContext ContextNoBody) (Contextable, error) { var c Contextable err := validateParams(baseContext) @@ -109,7 +109,7 @@ func HTTPHandler[ReturnType, Body any, Contextable ctxWithBody[Body]](s *Server, templates = template.Must(s.template.Clone()) } - ctx, err := InitContext[Contextable](ContextNoBody{ + ctx, err := initContext[Contextable](ContextNoBody{ Req: r, Res: w, readOptions: readOptions{ diff --git a/serve_test.go b/serve_test.go index 54cc5e1f..132fe332 100644 --- a/serve_test.go +++ b/serve_test.go @@ -351,7 +351,7 @@ func TestIni(t *testing.T) { t.Run("can initialize ContextNoBody", func(t *testing.T) { req := httptest.NewRequest("GET", "/ctx/error-in-rendering", nil) w := httptest.NewRecorder() - ctx, err := InitContext[ContextNoBody](ContextNoBody{ + ctx, err := initContext[ContextNoBody](ContextNoBody{ Req: req, Res: w, }) @@ -365,7 +365,7 @@ func TestIni(t *testing.T) { t.Run("can initialize ContextNoBody", func(t *testing.T) { req := httptest.NewRequest("GET", "/ctx/error-in-rendering", nil) w := httptest.NewRecorder() - ctx, err := InitContext[*ContextNoBody](ContextNoBody{ + ctx, err := initContext[*ContextNoBody](ContextNoBody{ Req: req, Res: w, }) @@ -379,7 +379,7 @@ func TestIni(t *testing.T) { t.Run("can initialize ContextWithBody[string]", func(t *testing.T) { req := httptest.NewRequest("GET", "/ctx/error-in-rendering", nil) w := httptest.NewRecorder() - ctx, err := InitContext[*ContextWithBody[string]](ContextNoBody{ + ctx, err := initContext[*ContextWithBody[string]](ContextNoBody{ Req: req, Res: w, }) @@ -393,7 +393,7 @@ func TestIni(t *testing.T) { t.Run("can initialize ContextWithBody[struct]", func(t *testing.T) { req := httptest.NewRequest("GET", "/ctx/error-in-rendering", nil) w := httptest.NewRecorder() - ctx, err := InitContext[*ContextWithBody[ans]](ContextNoBody{ + ctx, err := initContext[*ContextWithBody[ans]](ContextNoBody{ Req: req, Res: w, }) @@ -409,7 +409,7 @@ func TestIni(t *testing.T) { w := httptest.NewRecorder() require.Panics(t, func() { - InitContext[ctxWithBody[any]](ContextNoBody{ + initContext[ctxWithBody[any]](ContextNoBody{ Req: req, Res: w, })