mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-05 14:44:49 -04:00
A few code corrections
parent
a8d58f0970
commit
56c629ef89
@ -14,15 +14,15 @@ Handlers are usually a struct with at least one field, the next Handler in the c
|
||||
|
||||
```go
|
||||
type MyHandler struct {
|
||||
Next middleware.HandlerFunc
|
||||
Next middleware.Handler
|
||||
}
|
||||
```
|
||||
|
||||
It must implement the middleware.Handler interface. We do this by adding a method called ServeHTTP, which happens to be a middlware.HandlerFunc. Right now, let's just pass the request to the next Handler in the chain:
|
||||
It must also implement the middleware.Handler interface. We do this by adding a method called ServeHTTP. Right now, let's just pass the request to the next Handler in the chain:
|
||||
|
||||
```go
|
||||
func (h MyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
return h.Next(w, r)
|
||||
return h.Next.ServeHTTP(w, r)
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user