MCPcopy
hub / github.com/writefreely/writefreely / Gopher

Method Gopher

handle.go:984–1000  ·  view source on GitHub ↗
(f gopherFunc)

Source from the content-addressed store, hash-verified

982}
983
984func (h *Handler) Gopher(f gopherFunc) gopher.HandlerFunc {
985 return func(w gopher.ResponseWriter, r *gopher.Request) {
986 defer func() {
987 if e := recover(); e != nil {
988 log.Error("%s: %s", e, debug.Stack())
989 w.WriteError("An internal error occurred")
990 }
991 log.Info("gopher: %s", r.Selector)
992 }()
993
994 err := f(h.app.App(), w, r)
995 if err != nil {
996 log.Error("failed: %s", err)
997 w.WriteError("the page failed for some reason (see logs)")
998 }
999 }
1000}
1001
1002func sendRedirect(w http.ResponseWriter, code int, location string) int {
1003 w.Header().Set("Location", location)

Callers 1

initGopherFunction · 0.80

Calls 2

AppMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected