mirror of https://github.com/gofiber/fiber.git
✅ Fix gosec and tests
parent
9269513917
commit
bc3b69ccca
|
@ -191,7 +191,10 @@ func New(config ...Config) fiber.Handler {
|
|||
}
|
||||
|
||||
// Store those bytes
|
||||
cfg.Store.Set(key, buf.Bytes(), time.Duration(0))
|
||||
err = cfg.Store.Set(key, buf.Bytes(), time.Duration(0))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
sessions[key] = session
|
||||
}
|
||||
|
|
|
@ -119,8 +119,10 @@ func Test_Limiter_Headers(t *testing.T) {
|
|||
app.Handler()(fctx)
|
||||
|
||||
utils.AssertEqual(t, "50", string(fctx.Response.Header.Peek("X-RateLimit-Limit")))
|
||||
utils.AssertEqual(t, "48", string(fctx.Response.Header.Peek("X-RateLimit-Remaining")))
|
||||
if v := string(fctx.Response.Header.Peek("X-RateLimit-Reset")); v != "" {
|
||||
t.Errorf("The X-RateLimit-Remaining header is not set correctly - value is an empty string.")
|
||||
}
|
||||
if v := string(fctx.Response.Header.Peek("X-RateLimit-Reset")); !(v == "1" || v == "2") {
|
||||
t.Errorf("The X-RateLimit-Reset header is not set correctly - value is an empty string.")
|
||||
t.Errorf("The X-RateLimit-Reset header is not set correctly - value is out of bounds.")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue