* ♻️ Refactor: Extract testConn err to variable
* ♻️ Refactor: Extract ErrTestGotEmptyResponse from app.Test()
* 🩹 Fix: Fix `app.Test()` auto-failing when testConn is closed
* 🩹 Fix(app_test.go): Use tab for indent instead of spaces
* 🩹 Fix(app_test.go): Fix to respect gofmt linter
* ♻️ Refactor: Update Drop tests to verify error type
* feat(timeout): unify and enhance timeout middleware
- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors
* feat(timeout): unify and enhance timeout middleware
- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors
* refactor(timeout): remove goroutine-based logic and improve documentation
- Switch to a synchronous approach to avoid data races with fasthttp context
- Enhance error handling for deadline and custom errors
- Update comments for clarity and maintainability
* refactor(timeout): add more test cases and handle zero duration case
* refactor(timeout): add more test cases and handle zero duration case
* refactor(timeout): add more test cases and handle zero duration case
---------
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
* Add Drop method to DefaultCtx and remove redundant checks
Introduced a Drop method in DefaultCtx for closing connections, enabling easier resource management. Removed unnecessary nil-checks for headers in manager_msgp to simplify code logic. Added a unit test to ensure the new Drop method behaves as expected.
* Add `Drop` method to Fiber context API documentation
The `Drop` method allows silently terminating client connections without sending HTTP headers or a response body. This is useful for scenarios like mitigating DDoS attacks or blocking unauthorized access to sensitive endpoints. Example usage and function signature are included in the updated documentation.
* Remove extraneous blank line in documentation.
Eliminated an unnecessary blank line in the API context documentation for improved readability and formatting consistency. No functional changes were made to the content.
* Update API documentation example to return "Hello World!"
Revised the example code in the API documentation to return a generic "Hello World!" string instead of a dynamic response. This improves consistency and simplifies the example for easier understanding.
* Refactor Drop method and extend test coverage.
Simplified the Drop method by inlining the connection close call. Added new test cases to ensure proper handling of no-response scenarios and improved overall test coverage.
* fix golangci-lint issue
* Add test for Ctx.Drop with middleware interaction
This test ensures the correct behavior of the Ctx.Drop method when used with middleware, including response handling and error scenarios. It verifies that the middleware and handler properly handle the Drop call and its resulting effects.
* Add Drop method to DefaultCtx for closing connections
The Drop method allows closing connections without sending a response, improving control over connection handling. Also updated a test assertion to use StatusOK for improved readability and consistency.
* Refine Drop method comments to clarify error handling.
Explain the rationale for not wrapping errors in the Drop method. Emphasize that the returned error is solely for logging and not for further propagation or processing.
* Update Drop method documentation for clarity
Clarified the `Drop` method's behavior, specifying that it closes the connection without sending headers or a body. Added examples of use cases, such as DDoS mitigation and blocking sensitive endpoints.
* Refactor response header setting in middleware.
Replaced the direct header setting with the `Set` method for consistency and improved clarity. Removed a test case checking for a panic on closed response body as it is no longer applicable.
* Make tls.Config MinVersion configurable
This commit will resolve#3239
For more info: https://github.com/gofiber/fiber/issues/3239
* Add documents about tls minimum version configurable
* Add if statement for don't allow to use TLS1.0 and TLS1.1
* Fix lint issues, add test for panic()
* Update docs
* Add test with valid TLS version
---------
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
* 🩹 fix: make SetValWithStruct set zero values and support more types
* 🚨 test: check zero in int_slice
* fix: SetValWithStruct does not exist in fiber v2
* 🩹fix: restrict supported types in SetValWithStruct
* 🩹fix: golangci-lint
---------
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
* feat: add a simple support for app.Listen
* fix: fix the nil access error
* chore: add test case for simple tls
* fix: align the struct
* chore: change the test case
can't passed and not chack the file yet
* fix: use TLS1.2 min
* Fix lint issues
* Fix call to os.MkdirTemp
* Fix test check order
* Update unit-tests for ACME
* Update docs
* Fix identation of whats_new examples
* More updates to docs
* Remove ACME tests. Add check for tlsConfig
* Add ACME section to whats_new docs
* Update docs/whats_new.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update fiber.md
* Update whats_new.md
---------
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* 🔥 feat: Add support for graceful shutdown timeout in Listen
* 📚 doc: update the description of GracefulShutdownTimeout
* ♻️refact: use require.ErrorIs instead of require.Equal
* fix: Target error should be in err chain by using fasthttputil.ErrInmemoryListenerClosed
* ♻️refact: use require.ErrorIs instead of require.Equal
* 📚doc: update the description of GracefulShutdownTimeout
* ♻️refact: rename GracefulShutdownTimeout to ShutdownTimeout
* 🩹fix: set default ShutdownTimeout to 10s
---------
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>