From f75f3b076a18ec06ff7fdf6371b0f20b2b67b178 Mon Sep 17 00:00:00 2001 From: Skyenought Date: Sat, 25 Nov 2023 14:39:41 +0800 Subject: [PATCH] fix: unit test fail in windows --- pkg/route/routergroup_test.go | 5 ++++- pkg/route/routes_test.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/route/routergroup_test.go b/pkg/route/routergroup_test.go index 3a6a1c07b..25ef7e461 100644 --- a/pkg/route/routergroup_test.go +++ b/pkg/route/routergroup_test.go @@ -147,7 +147,10 @@ func TestRouterGroupStatic(t *testing.T) { func TestRouterGroupStaticFile(t *testing.T) { router := NewEngine(config.NewOptions(nil)) router.StaticFile("file", "./engine.go") - w := performRequest(router, "GET", "/file") + w := performRequest(router, "GET", "/file", header{ + Key: "Host", + Value: "127.0.0.1", + }) assert.DeepEqual(t, http.StatusOK, w.Code) fd, err := os.Open("./engine.go") if err != nil { diff --git a/pkg/route/routes_test.go b/pkg/route/routes_test.go index 1e76d673e..f7c937771 100644 --- a/pkg/route/routes_test.go +++ b/pkg/route/routes_test.go @@ -415,7 +415,10 @@ func TestRouteStaticFile(t *testing.T) { router.StaticFile("/result", f.Name()) w := performRequest(router, consts.MethodGet, "/using_static/"+filename) - w2 := performRequest(router, consts.MethodGet, "/result") + w2 := performRequest(router, consts.MethodGet, "/result", header{ + Key: "Host", + Value: "127.0.0.1", + }) assert.DeepEqual(t, w, w2) assert.DeepEqual(t, consts.StatusOK, w.Code)