Documentation ¶
Index ¶
- Constants
- func Pretty(r *http.Request) bool
- func RespondError(w http.ResponseWriter, r *http.Request, statusCode int, err error, ...)
- func RespondErrorf(w http.ResponseWriter, r *http.Request, statusCode int, format string, ...)
- func RespondJSON(w http.ResponseWriter, r *http.Request, statusCode int, obj any)
- func RespondNotFound(w http.ResponseWriter)
- func RespondText(w http.ResponseWriter, r *http.Request, statusCode int, text string)
- func ResponseLogFields(statusCode int) logrus.Fields
- func StartTimeIntoRequest(r *http.Request, t0 time.Time) *http.Request
- type DirectoryHandler
- func (h *DirectoryHandler) Handle(pattern string, handler http.Handler, dirListers ...DirectoryLister)
- func (h *DirectoryHandler) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request), ...)
- func (n *DirectoryHandler) MarshalJSON() ([]byte, error)
- func (h *DirectoryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type DirectoryLister
- type StatusRecorder
Constants ¶
View Source
const (
StatusClientClosedRequest = 499
)
Variables ¶
This section is empty.
Functions ¶
func RespondError ¶
func RespondErrorf ¶
func RespondJSON ¶
func RespondNotFound ¶
func RespondNotFound(w http.ResponseWriter)
func RespondText ¶
func ResponseLogFields ¶
Types ¶
type DirectoryHandler ¶
type DirectoryHandler struct {
// contains filtered or unexported fields
}
func (*DirectoryHandler) Handle ¶
func (h *DirectoryHandler) Handle(pattern string, handler http.Handler, dirListers ...DirectoryLister)
func (*DirectoryHandler) HandleFunc ¶
func (h *DirectoryHandler) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request), dirListers ...DirectoryLister)
func (*DirectoryHandler) MarshalJSON ¶
func (*DirectoryHandler) ServeHTTP ¶
func (h *DirectoryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type DirectoryLister ¶
DirectoryLister is a function that must read the current request context if necessary and list the entries for a directory. If there are errors the function should send the response to the client immediately, otherwise it should return an updated request context possibly containing useful information extracted from the request for future callers.
type StatusRecorder ¶
type StatusRecorder struct { http.ResponseWriter // contains filtered or unexported fields }
func (*StatusRecorder) StatusCode ¶
func (s *StatusRecorder) StatusCode() int
func (*StatusRecorder) WriteHeader ¶
func (s *StatusRecorder) WriteHeader(statusCode int)
func (*StatusRecorder) WriteHeaderCalled ¶
func (s *StatusRecorder) WriteHeaderCalled() bool
Click to show internal directories.
Click to hide internal directories.