@@ -23,7 +23,7 @@ func (m *mockDomainChecker) CheckDomain(ctx context.Context, req gateway.DomainC
2323 return & gateway.DomainCheckResponse {}, nil
2424}
2525
26- func TestAssetsCORSMiddleware (t * testing.T ) {
26+ func TestFilesCORSMiddleware (t * testing.T ) {
2727 t .Run ("no origin header continues without CORS headers" , func (t * testing.T ) {
2828 e := echo .New ()
2929 req := httptest .NewRequest ("GET" , "/" , nil )
@@ -35,7 +35,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
3535 return c .String (http .StatusOK , "OK" )
3636 }
3737
38- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
38+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
3939 h := middleware (handler )
4040
4141 err := h (c )
@@ -59,7 +59,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
5959 return c .String (http .StatusOK , "OK" )
6060 }
6161
62- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" , "https://test.com" })
62+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" , "https://test.com" })
6363 h := middleware (handler )
6464
6565 err := h (c )
@@ -92,7 +92,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
9292 return c .String (http .StatusOK , "OK" )
9393 }
9494
95- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
95+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
9696 h := middleware (handler )
9797
9898 err := h (c )
@@ -121,7 +121,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
121121 return c .String (http .StatusOK , "OK" )
122122 }
123123
124- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
124+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
125125 h := middleware (handler )
126126
127127 err := h (c )
@@ -150,7 +150,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
150150 return c .String (http .StatusOK , "OK" )
151151 }
152152
153- middleware := AssetsCORSMiddleware (mockChecker , []string {})
153+ middleware := FilesCORSMiddleware (mockChecker , []string {})
154154 h := middleware (handler )
155155
156156 err := h (c )
@@ -176,7 +176,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
176176 return c .String (http .StatusOK , "OK" )
177177 }
178178
179- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
179+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
180180 h := middleware (handler )
181181
182182 err := h (c )
@@ -199,7 +199,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
199199 return c .String (http .StatusOK , "OK" )
200200 }
201201
202- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
202+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
203203 h := middleware (handler )
204204
205205 err := h (c )
@@ -225,7 +225,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
225225 return c .String (http .StatusOK , "OK" )
226226 }
227227
228- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
228+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
229229 h := middleware (handler )
230230
231231 err := h (c )
@@ -246,7 +246,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
246246 return c .String (http .StatusOK , "OK" )
247247 }
248248
249- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
249+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
250250 h := middleware (handler )
251251
252252 err := h (c )
@@ -267,7 +267,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
267267 return c .String (http .StatusOK , "OK" )
268268 }
269269
270- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
270+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://first.com" , "https://second.com" , "https://third.com" })
271271 h := middleware (handler )
272272
273273 err := h (c )
@@ -295,7 +295,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
295295 return c .String (http .StatusOK , "OK" )
296296 }
297297
298- middleware := AssetsCORSMiddleware (mockChecker , []string {})
298+ middleware := FilesCORSMiddleware (mockChecker , []string {})
299299 h := middleware (handler )
300300
301301 err := h (c )
@@ -321,7 +321,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
321321 return c .String (http .StatusOK , "OK" )
322322 }
323323
324- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
324+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
325325 h := middleware (handler )
326326
327327 err := h (c )
@@ -343,7 +343,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
343343 return c .String (http .StatusOK , "OK" )
344344 }
345345
346- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
346+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
347347 h := middleware (handler )
348348
349349 err := h (c )
@@ -365,7 +365,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
365365 return c .String (http .StatusOK , "OK" )
366366 }
367367
368- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
368+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
369369 h := middleware (handler )
370370
371371 err := h (c )
@@ -377,7 +377,7 @@ func TestAssetsCORSMiddleware(t *testing.T) {
377377 })
378378}
379379
380- func TestAssetsCORSMiddleware_ConcurrentRequests (t * testing.T ) {
380+ func TestFilesCORSMiddleware_ConcurrentRequests (t * testing.T ) {
381381 e := echo .New ()
382382
383383 mockChecker := & mockDomainChecker {
@@ -386,7 +386,7 @@ func TestAssetsCORSMiddleware_ConcurrentRequests(t *testing.T) {
386386 },
387387 }
388388
389- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://allowed.com" })
389+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://allowed.com" })
390390
391391 handler := func (c echo.Context ) error {
392392 return c .String (http .StatusOK , "OK" )
@@ -423,7 +423,7 @@ func TestAssetsCORSMiddleware_ConcurrentRequests(t *testing.T) {
423423 }
424424}
425425
426- func TestAssetsCORSMiddleware_NilDomainChecker (t * testing.T ) {
426+ func TestFilesCORSMiddleware_NilDomainChecker (t * testing.T ) {
427427 e := echo .New ()
428428
429429 t .Run ("origin not in allowed list - panics" , func (t * testing.T ) {
@@ -436,7 +436,7 @@ func TestAssetsCORSMiddleware_NilDomainChecker(t *testing.T) {
436436 return c .String (http .StatusOK , "OK" )
437437 }
438438
439- middleware := AssetsCORSMiddleware (nil , []string {"https://allowed.com" })
439+ middleware := FilesCORSMiddleware (nil , []string {"https://allowed.com" })
440440 h := middleware (handler )
441441
442442 assert .Panics (t , func () {
@@ -454,7 +454,7 @@ func TestAssetsCORSMiddleware_NilDomainChecker(t *testing.T) {
454454 return c .String (http .StatusOK , "OK" )
455455 }
456456
457- middleware := AssetsCORSMiddleware (nil , []string {"https://allowed.com" })
457+ middleware := FilesCORSMiddleware (nil , []string {"https://allowed.com" })
458458 h := middleware (handler )
459459
460460 assert .NotPanics (t , func () {
@@ -466,7 +466,7 @@ func TestAssetsCORSMiddleware_NilDomainChecker(t *testing.T) {
466466 })
467467}
468468
469- func TestAssetsCORSMiddleware_EdgeCases (t * testing.T ) {
469+ func TestFilesCORSMiddleware_EdgeCases (t * testing.T ) {
470470 t .Run ("origin with trailing slash" , func (t * testing.T ) {
471471 e := echo .New ()
472472 req := httptest .NewRequest ("GET" , "/" , nil )
@@ -487,7 +487,7 @@ func TestAssetsCORSMiddleware_EdgeCases(t *testing.T) {
487487 return c .String (http .StatusOK , "OK" )
488488 }
489489
490- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
490+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
491491 h := middleware (handler )
492492
493493 err := h (c )
@@ -513,7 +513,7 @@ func TestAssetsCORSMiddleware_EdgeCases(t *testing.T) {
513513 return c .String (http .StatusOK , "OK" )
514514 }
515515
516- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
516+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
517517 h := middleware (handler )
518518
519519 err := h (c )
@@ -534,7 +534,7 @@ func TestAssetsCORSMiddleware_EdgeCases(t *testing.T) {
534534 return c .String (http .StatusOK , "OK" )
535535 }
536536
537- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com:8080" })
537+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com:8080" })
538538 h := middleware (handler )
539539
540540 err := h (c )
@@ -555,7 +555,7 @@ func TestAssetsCORSMiddleware_EdgeCases(t *testing.T) {
555555 return c .String (http .StatusOK , "OK" )
556556 }
557557
558- middleware := AssetsCORSMiddleware (mockChecker , []string {"http://localhost:3000" })
558+ middleware := FilesCORSMiddleware (mockChecker , []string {"http://localhost:3000" })
559559 h := middleware (handler )
560560
561561 err := h (c )
@@ -565,10 +565,10 @@ func TestAssetsCORSMiddleware_EdgeCases(t *testing.T) {
565565 })
566566}
567567
568- func BenchmarkAssetsCORSMiddleware_AllowedOrigin (b * testing.B ) {
568+ func BenchmarkFilesCORSMiddleware_AllowedOrigin (b * testing.B ) {
569569 e := echo .New ()
570570 mockChecker := & mockDomainChecker {}
571- middleware := AssetsCORSMiddleware (mockChecker , []string {"https://example.com" })
571+ middleware := FilesCORSMiddleware (mockChecker , []string {"https://example.com" })
572572
573573 handler := func (c echo.Context ) error {
574574 return c .String (http .StatusOK , "OK" )
@@ -586,14 +586,14 @@ func BenchmarkAssetsCORSMiddleware_AllowedOrigin(b *testing.B) {
586586 }
587587}
588588
589- func BenchmarkAssetsCORSMiddleware_DomainChecker (b * testing.B ) {
589+ func BenchmarkFilesCORSMiddleware_DomainChecker (b * testing.B ) {
590590 e := echo .New ()
591591 mockChecker := & mockDomainChecker {
592592 checkFunc : func (ctx context.Context , req gateway.DomainCheckRequest ) (* gateway.DomainCheckResponse , error ) {
593593 return & gateway.DomainCheckResponse {Allowed : true }, nil
594594 },
595595 }
596- middleware := AssetsCORSMiddleware (mockChecker , []string {})
596+ middleware := FilesCORSMiddleware (mockChecker , []string {})
597597
598598 handler := func (c echo.Context ) error {
599599 return c .String (http .StatusOK , "OK" )
0 commit comments