mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-28 14:45:49 +08:00
Detailed godoc; better error handling convention
This commit is contained in:
@ -5,6 +5,7 @@ package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -116,7 +117,13 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
http.StatusInternalServerError)
|
||||
}
|
||||
}()
|
||||
s.stack(w, r)
|
||||
|
||||
status, _ := s.stack(w, r)
|
||||
|
||||
if status >= 400 {
|
||||
w.WriteHeader(status)
|
||||
fmt.Fprintf(w, "%d %s", status, http.StatusText(status))
|
||||
}
|
||||
}
|
||||
|
||||
// buildStack builds the server's middleware stack based
|
||||
|
Reference in New Issue
Block a user