Skip to content
Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.24.0
toolchain go1.24.2

require (
github.com/fox-toolkit/fox v0.27.0
github.com/fox-toolkit/fox v0.27.1
github.com/stretchr/testify v1.11.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fox-toolkit/fox v0.27.0 h1:UWJWnBWiICZXUjatMKTm+VkQ1/1iSYerXnAdLNsprBk=
github.com/fox-toolkit/fox v0.27.0/go.mod h1:HouPMFaCy2U6iU2oztgiS62p7sX4NKhP4FnSZzvoqvk=
github.com/fox-toolkit/fox v0.27.1 h1:9D7qB41usalO4DyP/zLqy8nuCgrHUMydVUAeFJ6z1bw=
github.com/fox-toolkit/fox v0.27.1/go.mod h1:HouPMFaCy2U6iU2oztgiS62p7sX4NKhP4FnSZzvoqvk=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down
8 changes: 4 additions & 4 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func (f optionFunc) apply(c *config) {

func defaultConfig() *config {
return &config{
resp: DefaultTimeoutResponse,
resp: DefaultResponse,
}
}

// WithResponse sets a custom response handler function for the middleware.
// This function will be invoked when a timeout occurs, allowing for custom responses
// to be sent back to the client. If not set, the middleware use [DefaultTimeoutResponse].
// to be sent back to the client. If not set, the middleware use [DefaultResponse].
func WithResponse(h fox.HandlerFunc) Option {
return optionFunc(func(c *config) {
if h != nil {
Expand All @@ -41,7 +41,7 @@ func WithResponse(h fox.HandlerFunc) Option {
})
}

// DefaultTimeoutResponse sends a default 503 Service Unavailable response.
func DefaultTimeoutResponse(c *fox.Context) {
// DefaultResponse sends a default 503 Service Unavailable response.
func DefaultResponse(c *fox.Context) {
http.Error(c.Writer(), http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
}