* 🐛 Fix: Expiration time in cache middleware
* Custom expiration time using ExpirationGenerator is also functional
now instead of default Expiration only
* 🚨 Improve Test_CustomExpiration
* - stabilization of the tests
- speed up the cache tests
- fix race conditions in client and client tests
Co-authored-by: wernerr <rene@gofiber.io>
* Return an instance of `*fiber.Error` when no handler found
When a handler cannot be found for a given path, previously Fiber
would construct a plaintext response that cannot be modified.
This commit switches to returning a new instance of `*fiber.Error`
with identical error message so that users can customise the look
of their 404 pages.
Signed-off-by: AKP <tom@tdpain.net>
* Fix `Test_App_Next_Method`
This test was failing as the error returned by `c.Next()` that's
required to generate the correct 404 status code was not being
passed through the middleware and being silently ignored.
Signed-off-by: AKP <tom@tdpain.net>
* Fix `Test_Logger_All`
Signed-off-by: AKP <tom@tdpain.net>
* Fix `Test_Cache_WithHeadThenGet` test
As far as I can tell, this test is meant to check that a cached
HEAD request to a given endpoint does not return the cached
content to a GET request to the same endpoint, and the test has
been altered to correctly check for this.
Signed-off-by: AKP <tom@tdpain.net>
* ✨ Cache middleware: Store e2e headers.
As defined in RFC2616 - section-13.5.1, shared caches MUST
store end-to-end headers from backend response and MUST be
transmitted in any response formed from a cache entry.
This commit ensures a stronger consistency between responses
served from the handlers & from the cache middleware.
* ✨ Cache middleware: Add flag for e2e headers.
Set flag to prevent e2e headers caching to
be the default behavior of the cache middleware.
This would otherwise change quite a lot the
experience for cache middleware current users.
* ✨ Cache middleware: Add Benchmark for additionalHeaders feature.
* ✨ Cache middleware: Rename E2Eheaders into StoreResponseHeaders.
E2E is an acronym commonly associated with test.
While in the present case it refers to end-to-end
HTTP headers (by opposition to hop-by-hop), this
still remains confusing. This commits renames it
to a more generic name.
* ✨ Cache middleware: Update README
* ✨ Cache middleware: Move map instanciation.
This will prevent an extra memory allocation for users
not interested in this feature.
* ✨ Cache middleware: Prevent memory allocation when StoreResponseHeaders is disabled.
* ✨ Cache middleware: Store e2e headers. #1807
- use set instead of add for the headers
- copy value from the headers -> prevent problems with mutable values
Co-authored-by: wernerr <rene@gofiber.io>
* Restore original URL after the proxy
* Use the Immutable string to restore
* Changing deprecated ImmutableString to CopyString
Co-authored-by: Geet Manghnani <gmanghna@in.ibm.com>
* feat(ctx): add SessionOnly property on Cookie struct
* feat(middleware/config): add CookieSessionOnly property on middleware Config struct
* feat(csrf): link config CookieSessionOnly with fiber.Cookie in create middleware function
* fix(ctx_test): add tests for SessionOnly cookie in test_ctx_cookie
* fix(readme): update readme in csrf middleware for CookieSessionOnly property
* remove deprecated property from CookieSessionOnly explaination comments
* added HEAD method to caching
* changed key due to head and get sharing same key
* Update cache.go
- add a improvement task for later
* Update cache.go
correct comment
Co-authored-by: Jesse Quinn <jesse.quinn@zpesystems.com>
Co-authored-by: RW <rene@gofiber.io>
- Add the options to use your own middleware(should be more modular over time).
- Add the Sliding window option(see #1247)
- A little bit better polished version of #1247.
- Mounted fiber and its sub apps error handlers are now saved a new
errorHandlers map in App
- New public App.ErrorHandler method that wraps the logic for which
error handler to user on any given context
- Error handler match logic based on request path <=> prefix accuracy
- Typo fixes
- Tests