Skip to content
This repository was archived by the owner on Feb 7, 2018. It is now read-only.

Commit 9967277

Browse files
author
Arthur White
committed
Remove type Handler
1 parent 182fc05 commit 9967277

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

handler.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ package core
22

33
import "net/http"
44

5-
// Handler represents a request handler.
6-
type Handler func(*Context)
7-
85
// HandlersStack contains a set of handlers.
96
type HandlersStack struct {
10-
Handlers []Handler // The handlers stack.
11-
PanicHandler Handler // The handler called in case of panic. Useful to send custom server error information. Context.Data["panic"] contains the panic error.
7+
Handlers []func(*Context) // The handlers stack.
8+
PanicHandler func(*Context) // The handler called in case of panic. Useful to send custom server error information. Context.Data["panic"] contains the panic error.
129
}
1310

1411
// defaultHandlersStack contains the default handlers stack used for serving.
@@ -20,24 +17,24 @@ func NewHandlersStack() *HandlersStack {
2017
}
2118

2219
// Use adds a handler to the handlers stack.
23-
func (hs *HandlersStack) Use(h Handler) {
20+
func (hs *HandlersStack) Use(h func(*Context)) {
2421
hs.Handlers = append(hs.Handlers, h)
2522
}
2623

2724
// Use adds a handler to the default handlers stack.
28-
func Use(h Handler) {
25+
func Use(h func(*Context)) {
2926
defaultHandlersStack.Use(h)
3027
}
3128

3229
// HandlePanic sets the panic handler of the handlers stack.
3330
// Context.Data["panic"] contains the panic error.
34-
func (hs *HandlersStack) HandlePanic(h Handler) {
31+
func (hs *HandlersStack) HandlePanic(h func(*Context)) {
3532
hs.PanicHandler = h
3633
}
3734

3835
// HandlePanic sets the panic handler of the default handlers stack.
3936
// Context.Data["panic"] contains the panic error.
40-
func HandlePanic(h Handler) {
37+
func HandlePanic(h func(*Context)) {
4138
defaultHandlersStack.HandlePanic(h)
4239
}
4340

0 commit comments

Comments
 (0)