Skip to content

Commit

Permalink
add more uts
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyenought committed Nov 8, 2023
1 parent 22cc5c9 commit 1c8b36e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/app/server/hertz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

0 comments on commit 1c8b36e

Please sign in to comment.