Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions middleware/idempotency/idempotency.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,6 @@ func New(config ...Config) fiber.Handler {
}
}

bodyLimit := c.App().Config().BodyLimit
if bodyLimit > 0 && len(res.Body) > bodyLimit {
_ = c.Locals(localsKeyWasPutToCache, false)
return nil
}

// Marshal response
bs, err := res.MarshalMsg(nil)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions middleware/idempotency/idempotency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func Test_New_StoreRetrieve_FilterHeaders(t *testing.T) {
require.Equal(t, 1, s.setCount)
}

func Test_New_SkipCache_WhenBodyTooLarge(t *testing.T) {
func Test_New_Cache_WhenBodyTooLarge(t *testing.T) {
t.Parallel()
bodyLimit := 8
app := fiber.New(fiber.Config{BodyLimit: bodyLimit})
Expand Down Expand Up @@ -374,10 +374,10 @@ func Test_New_SkipCache_WhenBodyTooLarge(t *testing.T) {
require.Equal(t, fiber.StatusOK, resp2.StatusCode)
require.Equal(t, oversized, body2)

require.Equal(t, 2, count)
require.Equal(t, 0, s.setCount)
require.Equal(t, 1, count)
require.Equal(t, 1, s.setCount)
require.Len(t, wasPut, 2)
require.False(t, wasPut[0])
require.True(t, wasPut[0])
require.False(t, wasPut[1])
}

Expand Down
Loading