diff --git a/pkg/app/server/hertz_test.go b/pkg/app/server/hertz_test.go index 5baa3ecf5..97e99f33e 100644 --- a/pkg/app/server/hertz_test.go +++ b/pkg/app/server/hertz_test.go @@ -1066,3 +1066,29 @@ func TestValidateConfigAndBindConfig(t *testing.T) { assert.Nil(t, err) time.Sleep(100 * time.Millisecond) } + +func TestWithDisableDefaultDate(t *testing.T) { + h := New( + WithHostPorts("localhost:8321"), + WithDisableDefaultDate(true), + ) + h.GET("/", func(_ context.Context, c *app.RequestContext) {}) + go h.Spin() + time.Sleep(100 * time.Millisecond) + hc := http.Client{Timeout: time.Second} + r, _ := hc.Get("http://127.0.0.1:8321") //nolint:errcheck + assert.DeepEqual(t, "", r.Header.Get("Date")) +} + +func TestWithDisableDefaultContentType(t *testing.T) { + h := New( + WithHostPorts("localhost:8324"), + WithDisableDefaultContentType(true), + ) + h.GET("/", func(_ context.Context, c *app.RequestContext) {}) + go h.Spin() + time.Sleep(100 * time.Millisecond) + hc := http.Client{Timeout: time.Second} + r, _ := hc.Get("http://127.0.0.1:8324") //nolint:errcheck + assert.DeepEqual(t, "", r.Header.Get("Content-Type")) +}