util.go

 1package web
 2
 3import (
 4	"fmt"
 5	"io"
 6	"net/http"
 7)
 8
 9func renderStatus(code int) http.HandlerFunc {
10	return func(w http.ResponseWriter, _ *http.Request) {
11		io.WriteString(w, fmt.Sprintf("%d %s", code, http.StatusText(code))) // nolint: errcheck
12		w.WriteHeader(code)
13	}
14}