@@ -18,7 +18,6 @@ func TestGSS(t *testing.T) {
1818 ResponseHeaders : map [string ]string {
1919 "X-Test" : "test" ,
2020 },
21- RateLimitPerMinute : 100 ,
2221 }
2322 fileServer := newFileServer (cfg , metrics ).init ()
2423 w := httptest .NewRecorder ()
@@ -29,27 +28,10 @@ func TestGSS(t *testing.T) {
2928 assert .Equal (t , "test" , w .Header ().Get ("X-Test" ))
3029 })
3130
32- t .Run ("rate limits requests" , func (t * testing.T ) {
33- t .Parallel ()
34-
35- cfg := & config {
36- RateLimitPerMinute : 100 ,
37- }
38- fileServer := newFileServer (cfg , metrics ).init ()
39- w := httptest .NewRecorder ()
40- r := httptest .NewRequest (http .MethodGet , "/" , nil )
41-
42- fileServer .Server .Handler .ServeHTTP (w , r )
43-
44- assert .NotEmpty (t , w .Header ().Get ("X-Ratelimit-Limit" ))
45- })
46-
4731 t .Run ("redirects index correctly" , func (t * testing.T ) {
4832 t .Parallel ()
4933
50- cfg := & config {
51- RateLimitPerMinute : 100 ,
52- }
34+ cfg := & config {}
5335 fileServer := newFileServer (cfg , metrics ).init ()
5436 w := httptest .NewRecorder ()
5537 r := httptest .NewRequest (http .MethodGet , "/index.html" , nil )
@@ -62,9 +44,7 @@ func TestGSS(t *testing.T) {
6244 t .Run ("serves HTML files succesfully" , func (t * testing.T ) {
6345 t .Parallel ()
6446
65- cfg := & config {
66- RateLimitPerMinute : 100 ,
67- }
47+ cfg := & config {}
6848 fileServer := newFileServer (cfg , metrics ).init ()
6949 w := httptest .NewRecorder ()
7050 r := httptest .NewRequest (http .MethodGet , "/" , nil )
@@ -79,9 +59,7 @@ func TestGSS(t *testing.T) {
7959 t .Run ("serves CSS files succesfully" , func (t * testing.T ) {
8060 t .Parallel ()
8161
82- cfg := & config {
83- RateLimitPerMinute : 100 ,
84- }
62+ cfg := & config {}
8563 fileServer := newFileServer (cfg , metrics ).init ()
8664 w := httptest .NewRecorder ()
8765 r := httptest .NewRequest (http .MethodGet , "/static/main.68aa49f7.css" , nil )
@@ -96,9 +74,7 @@ func TestGSS(t *testing.T) {
9674 t .Run ("serves JavaScript files succesfully" , func (t * testing.T ) {
9775 t .Parallel ()
9876
99- cfg := & config {
100- RateLimitPerMinute : 100 ,
101- }
77+ cfg := & config {}
10278 fileServer := newFileServer (cfg , metrics ).init ()
10379 w := httptest .NewRecorder ()
10480 r := httptest .NewRequest (http .MethodGet , "/static/main.8d3db4ef.js" , nil )
@@ -113,9 +89,7 @@ func TestGSS(t *testing.T) {
11389 t .Run ("serves other files succesfully" , func (t * testing.T ) {
11490 t .Parallel ()
11591
116- cfg := & config {
117- RateLimitPerMinute : 100 ,
118- }
92+ cfg := & config {}
11993 fileServer := newFileServer (cfg , metrics ).init ()
12094 w := httptest .NewRecorder ()
12195 r := httptest .NewRequest (http .MethodGet , "/static/main.8d3db4ef.js.LICENSE.txt" , nil )
@@ -129,9 +103,7 @@ func TestGSS(t *testing.T) {
129103 t .Run ("serves brotli files succesfully" , func (t * testing.T ) {
130104 t .Parallel ()
131105
132- cfg := & config {
133- RateLimitPerMinute : 100 ,
134- }
106+ cfg := & config {}
135107 fileServer := newFileServer (cfg , metrics ).init ()
136108 w := httptest .NewRecorder ()
137109 r := httptest .NewRequest (http .MethodGet , "/" , nil )
@@ -146,9 +118,7 @@ func TestGSS(t *testing.T) {
146118 t .Run ("serves brotli files under nested folders succesfully" , func (t * testing.T ) {
147119 t .Parallel ()
148120
149- cfg := & config {
150- RateLimitPerMinute : 100 ,
151- }
121+ cfg := & config {}
152122 fileServer := newFileServer (cfg , metrics ).init ()
153123 w := httptest .NewRecorder ()
154124 r := httptest .NewRequest (http .MethodGet , "/static/main.8d3db4ef.js" , nil )
@@ -165,9 +135,7 @@ func TestGSS(t *testing.T) {
165135 t .Run ("serves gzip files succesfully" , func (t * testing.T ) {
166136 t .Parallel ()
167137
168- cfg := & config {
169- RateLimitPerMinute : 100 ,
170- }
138+ cfg := & config {}
171139 fileServer := newFileServer (cfg , metrics ).init ()
172140 w := httptest .NewRecorder ()
173141 r := httptest .NewRequest (http .MethodGet , "/" , nil )
@@ -182,9 +150,7 @@ func TestGSS(t *testing.T) {
182150 t .Run ("serves gzip files under nested folders succesfully" , func (t * testing.T ) {
183151 t .Parallel ()
184152
185- cfg := & config {
186- RateLimitPerMinute : 100 ,
187- }
153+ cfg := & config {}
188154 fileServer := newFileServer (cfg , metrics ).init ()
189155 w := httptest .NewRecorder ()
190156 r := httptest .NewRequest (http .MethodGet , "/static/main.8d3db4ef.js" , nil )
@@ -201,9 +167,7 @@ func TestGSS(t *testing.T) {
201167 t .Run ("serves unexisting files without extension" , func (t * testing.T ) {
202168 t .Parallel ()
203169
204- cfg := & config {
205- RateLimitPerMinute : 100 ,
206- }
170+ cfg := & config {}
207171 fileServer := newFileServer (cfg , metrics ).init ()
208172 w := httptest .NewRecorder ()
209173 r := httptest .NewRequest (http .MethodGet , "/random-page" , nil )
@@ -218,9 +182,7 @@ func TestGSS(t *testing.T) {
218182 t .Run ("doesn't serve unexisting files with extension" , func (t * testing.T ) {
219183 t .Parallel ()
220184
221- cfg := & config {
222- RateLimitPerMinute : 100 ,
223- }
185+ cfg := & config {}
224186 fileServer := newFileServer (cfg , metrics ).init ()
225187 w := httptest .NewRecorder ()
226188 r := httptest .NewRequest (http .MethodGet , "/favicon.ico" , nil )
@@ -233,9 +195,7 @@ func TestGSS(t *testing.T) {
233195 t .Run ("serves a cached response for a fresh resource" , func (t * testing.T ) {
234196 t .Parallel ()
235197
236- cfg := & config {
237- RateLimitPerMinute : 100 ,
238- }
198+ cfg := & config {}
239199 fileServer := newFileServer (cfg , metrics ).init ()
240200
241201 t .Run ("HTML files should have Cache-Control: no-cache" , func (t * testing.T ) {
0 commit comments