@@ -63,6 +63,7 @@ func TestNewRelicAppConfig(t *testing.T) {
6363 })
6464
6565 r := httptest .NewRequest (http .MethodGet , "/" , nil )
66+ r .Host = "localhost"
6667 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
6768 assert .Equal (t , http .StatusOK , resp .StatusCode )
6869 })
@@ -92,6 +93,7 @@ func TestNewRelicAppConfig(t *testing.T) {
9293 })
9394
9495 r := httptest .NewRequest ("GET" , "/" , nil )
96+ r .Host = "localhost"
9597 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
9698 assert .Equal (t , 200 , resp .StatusCode )
9799 })
@@ -112,6 +114,7 @@ func TestNewRelicAppConfig(t *testing.T) {
112114 })
113115
114116 r := httptest .NewRequest ("GET" , "/invalid-url" , nil )
117+ r .Host = "localhost"
115118 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
116119 assert .Equal (t , 404 , resp .StatusCode )
117120 })
@@ -132,6 +135,7 @@ func TestNewRelicAppConfig(t *testing.T) {
132135 })
133136
134137 r := httptest .NewRequest ("GET" , "/" , nil )
138+ r .Host = "localhost"
135139 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
136140 assert .Equal (t , 200 , resp .StatusCode )
137141 })
@@ -152,6 +156,7 @@ func TestNewRelicAppConfig(t *testing.T) {
152156 })
153157
154158 r := httptest .NewRequest ("GET" , "/" , nil )
159+ r .Host = "localhost"
155160 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
156161 assert .Equal (t , 200 , resp .StatusCode )
157162 })
@@ -172,6 +177,7 @@ func TestNewRelicAppConfig(t *testing.T) {
172177 })
173178
174179 r := httptest .NewRequest ("GET" , "/" , nil )
180+ r .Host = "localhost"
175181 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
176182 assert .Equal (t , 200 , resp .StatusCode )
177183 })
@@ -199,6 +205,7 @@ func TestNewRelicAppConfig(t *testing.T) {
199205 assert .NotNil (t , newrelicApp )
200206
201207 r := httptest .NewRequest ("GET" , "/" , nil )
208+ r .Host = "localhost"
202209 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
203210 assert .Equal (t , 200 , resp .StatusCode )
204211 })
@@ -241,7 +248,9 @@ func TestNewRelicAppConfig(t *testing.T) {
241248 app .Get ("/" , func (ctx fiber.Ctx ) error { return errors .New ("system error" ) })
242249
243250 // when
244- resp , err := app .Test (httptest .NewRequest ("GET" , "/" , nil ), fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
251+ r := httptest .NewRequest ("GET" , "/" , nil )
252+ r .Host = "localhost"
253+ resp , err := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
245254 assert .NoError (t , err )
246255 assert .Equal (t , http .StatusInternalServerError , resp .StatusCode )
247256 })
@@ -268,7 +277,9 @@ func TestNewRelicAppConfig(t *testing.T) {
268277 app .Get ("/" , func (ctx fiber.Ctx ) error { return errors .New ("system error" ) })
269278
270279 // when
271- resp , err := app .Test (httptest .NewRequest ("GET" , "/" , nil ), fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
280+ r := httptest .NewRequest ("GET" , "/" , nil )
281+ r .Host = "localhost"
282+ resp , err := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
272283 assert .NoError (t , err )
273284 assert .Equal (t , http .StatusInternalServerError , resp .StatusCode )
274285 assert .True (t , errorStatusCodeHandlerCalled )
@@ -302,6 +313,7 @@ func TestNewRelicAppConfig(t *testing.T) {
302313 })
303314
304315 r := httptest .NewRequest ("GET" , "/jump" , nil )
316+ r .Host = "localhost"
305317 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
306318 assert .Equal (t , 200 , resp .StatusCode )
307319 })
@@ -334,6 +346,7 @@ func TestNewRelicAppConfig(t *testing.T) {
334346 })
335347
336348 r := httptest .NewRequest ("GET" , "/" , nil )
349+ r .Host = "localhost"
337350 resp , _ := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
338351 assert .Equal (t , 200 , resp .StatusCode )
339352 })
@@ -370,7 +383,9 @@ func TestDefaultErrorStatusCodeHandler(t *testing.T) {
370383 })
371384
372385 // when
373- resp , err := app .Test (httptest .NewRequest ("GET" , "/" , nil ), fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
386+ r := httptest .NewRequest ("GET" , "/" , nil )
387+ r .Host = "localhost"
388+ resp , err := app .Test (r , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
374389 assert .NoError (t , err )
375390 assert .Equal (t , http .StatusNotFound , resp .StatusCode )
376391 })
@@ -398,6 +413,7 @@ func TestFromContext(t *testing.T) {
398413 })
399414
400415 req := httptest .NewRequest (http .MethodGet , "/foo" , http .NoBody )
416+ req .Host = "localhost"
401417
402418 // when
403419 res , err := app .Test (req , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
@@ -417,7 +433,8 @@ func TestCreateWebRequest(t *testing.T) {
417433 return ctx .SendStatus (http .StatusNoContent )
418434 })
419435
420- r := httptest .NewRequest (http .MethodGet , "http://example.com/" , nil )
436+ r := httptest .NewRequest (http .MethodGet , "/" , nil )
437+ r .Host = "example.com"
421438 r .Header .Set ("traceparent" , "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" )
422439 r .Header .Add ("X-Custom" , "abc" )
423440 r .Header .Add ("X-Custom" , "def" )
@@ -438,7 +455,8 @@ func TestCreateWebRequest(t *testing.T) {
438455 return ctx .SendStatus (http .StatusNoContent )
439456 })
440457
441- r := httptest .NewRequest (http .MethodGet , "http://example.com/" , nil )
458+ r := httptest .NewRequest (http .MethodGet , "/" , nil )
459+ r .Host = "example.com"
442460 r .Header .Set ("traceparent" , "trace-value" )
443461 r .Header .Set ("Authorization" , "Bearer secret" )
444462
@@ -464,6 +482,7 @@ func TestFromContext_PassLocalsToContext(t *testing.T) {
464482 })
465483
466484 req := httptest .NewRequest (http .MethodGet , "/foo" , http .NoBody )
485+ req .Host = "localhost"
467486 res , err := app .Test (req , fiber.TestConfig {Timeout : 0 , FailOnTimeout : false })
468487 assert .NoError (t , err )
469488 assert .Equal (t , http .StatusOK , res .StatusCode )
0 commit comments