@@ -10,6 +10,7 @@ import (
10
10
"github.com/stretchr/testify/suite"
11
11
12
12
"github.com/gost-dom/browser/dom"
13
+ "github.com/gost-dom/browser/html"
13
14
. "github.com/gost-dom/browser/html"
14
15
. "github.com/gost-dom/browser/internal/testing/gomega-matchers"
15
16
"github.com/gost-dom/browser/internal/testing/gosttest"
@@ -72,6 +73,10 @@ func (s *WindowNavigationTestSuite) SetupTest() {
72
73
)
73
74
w .Write ([]byte (respBody ))
74
75
})
76
+ m .HandleFunc ("/infinite-redirects" , func (w http.ResponseWriter , r * http.Request ) {
77
+ http .Redirect (w , r , "/infinite-redirects" , 301 )
78
+ })
79
+
75
80
s .win = htmltest .NewWindowHelper (s .T (), NewWindowFromHandler (m ))
76
81
s .win .Navigate ("https://example.com/page-1" )
77
82
}
@@ -85,3 +90,8 @@ func (s *WindowNavigationTestSuite) TestRedirectGetRequests() {
85
90
s .win .HTMLDocument ().GetHTMLElementById ("link" ).Click ()
86
91
s .Assert ().Equal ("https://example.com/new-page-2" , s .win .Location ().Href ())
87
92
}
93
+
94
+ func (s * WindowNavigationTestSuite ) TestInfinteRedirects () {
95
+ err := s .win .Navigate ("/infinite-redirects" )
96
+ s .Assert ().ErrorIs (err , html .ErrTooManyRedirects , "Error is too many redirects" )
97
+ }
0 commit comments