From 9b3abb01f4f6ebfa1622cf3e223689d050d414e4 Mon Sep 17 00:00:00 2001 From: gaowenju Date: Mon, 11 Nov 2024 17:51:08 +0800 Subject: [PATCH] chore: fix typo --- pkg/protocol/http1/server.go | 8 ++++---- pkg/protocol/http1/server_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/protocol/http1/server.go b/pkg/protocol/http1/server.go index 6353f658a..6c01ba4ab 100644 --- a/pkg/protocol/http1/server.go +++ b/pkg/protocol/http1/server.go @@ -46,7 +46,7 @@ import ( func init() { if b, err := utils.GetBoolFromEnv("HERTZ_DISABLE_REQUEST_CONTEXT_POOL"); err == nil { hlog.Infof("HERTZ_DISABLE_REQUEST_CONTEXT_POOL env is set to %t", b) - disabaleRequestContextPool = b + disableRequestContextPool = b } } @@ -61,7 +61,7 @@ var ( errShortConnection = errs.New(errs.ErrShortConnection, errs.ErrorTypePublic, "server is going to close the connection") errUnexpectedEOF = errs.NewPublic(io.ErrUnexpectedEOF.Error() + " when reading request") - disabaleRequestContextPool = false + disableRequestContextPool = false ) type Option struct { @@ -92,14 +92,14 @@ type Server struct { } func (s Server) getRequestContext() *app.RequestContext { - if disabaleRequestContextPool { + if disableRequestContextPool { return &app.RequestContext{} } return s.Core.GetCtxPool().Get().(*app.RequestContext) } func (s Server) putRequestContext(ctx *app.RequestContext) { - if disabaleRequestContextPool { + if disableRequestContextPool { return } ctx.Reset() diff --git a/pkg/protocol/http1/server_test.go b/pkg/protocol/http1/server_test.go index d478b36fc..b44500bbc 100644 --- a/pkg/protocol/http1/server_test.go +++ b/pkg/protocol/http1/server_test.go @@ -236,10 +236,10 @@ func TestServerDisableReqCtxPool(t *testing.T) { defaultConn := mock.NewConn("GET / HTTP/1.1\nHost: foobar.com\n\n") err := server.Serve(context.TODO(), defaultConn) assert.Nil(t, err) - disabaleRequestContextPool = true + disableRequestContextPool = true defer func() { // reset global variable - disabaleRequestContextPool = false + disableRequestContextPool = false }() server.Core = &mockCore{ ctxPool: &sync.Pool{New: func() interface{} {