Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evg4b committed Nov 21, 2023
1 parent d3a5c02 commit 91c5e10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const (
)

type UncorsConfig struct {
HTTPPort int `mapstructure:"http-port" validate:"required"`
Mappings Mappings `mapstructure:"mappings" validate:"required"`
HTTPPort int `mapstructure:"http-port" validate:"required"`
Mappings Mappings `mapstructure:"mappings" validate:"required"`
Proxy string `mapstructure:"proxy"`
Debug bool `mapstructure:"debug"`
HTTPSPort int `mapstructure:"https-port"`
Expand Down
7 changes: 3 additions & 4 deletions internal/handler/cache/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ func TestCacheMiddleware(t *testing.T) {

t.Run("should not cache response between different hosts matched by one rule", func(t *testing.T) {
const count = 5
handler.Reset()

middleware := cache.NewMiddleware(
cache.WithCacheStorage(goCache.New(time.Minute, time.Minute)),
Expand All @@ -187,14 +186,14 @@ func TestCacheMiddleware(t *testing.T) {
cache.WithGlobs(config.CacheGlobs{"/api/**"}),
)

wrappedHandler := middleware.Wrap(handler)

handler := testutils.NewCounter(func(writer contracts.ResponseWriter, request *contracts.Request) {
writer.WriteHeader(http.StatusOK)
testutils.CopyHeaders(expectedHeader, writer.Header())
helpers.Fprintf(writer, request.Method)
helpers.Fprintf(writer, expectedBody)
})

wrappedHandler := middleware.Wrap(handler)

testutils.Times(count, func(index int) {
recorder := httptest.NewRecorder()
url := fmt.Sprintf("https://test-host-%d.com:4200/api/test", index)
Expand Down

0 comments on commit 91c5e10

Please sign in to comment.