Skip to content

Conversation

@appleboy
Copy link
Member

@appleboy appleboy commented Jul 18, 2025

  • Add a new example demonstrating Gin timeout and admin middleware usage
  • Implement a simple Gin server with timeout and custom auth middleware
  • Add a README explaining how to run and test the example, including expected timeout and unauthorized responses
  • Add go.mod and go.sum files for the new example with necessary dependencies and a local replace directive
  • Fix the timeout middleware to use the original context instead of a copy
  • Refactor and expand timeout middleware tests, including a test for using the middleware with gin.Use
  • Remove the WithHandler option and associated handler logic from the timeout middleware
  • Refactor middleware to always call c.Next() instead of a configurable handler
  • Update all usages and tests to remove WithHandler, passing handlers directly instead
  • Change test expectations for requests without a timeout to return HTTP 408 Request Timeout and its default message
  • Simplify the middleware configuration and usage throughout the codebase

fix #32

appleboy added 2 commits July 18, 2025 18:51
- Add a new example demonstrating Gin timeout and admin middleware usage
- Implement a simple Gin server with timeout and custom auth middleware
- Add a README explaining how to run and test the example, including expected timeout and unauthorized responses
- Add go.mod and go.sum files for the new example with necessary dependencies and a local replace directive
- Fix the timeout middleware to use the original context instead of a copy
- Refactor and expand timeout middleware tests, including a test for using the middleware with gin.Use

fix #32

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Remove the WithHandler option and associated handler logic from the timeout middleware
- Refactor middleware to always call c.Next() instead of a configurable handler
- Update all usages and tests to remove WithHandler, passing handlers directly instead
- Change test expectations for requests without a timeout to return HTTP 408 Request Timeout and its default message
- Simplify the middleware configuration and usage throughout the codebase

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@appleboy appleboy added the enhancement New feature or request label Jul 18, 2025
@appleboy appleboy merged commit 33ca6b7 into master Jul 18, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headers get overwritten if using multiple custom middlewares

2 participants