bump go modules

This commit is contained in:
Dmitry Verkhoturov
2021-10-29 11:48:46 -05:00
committed by Umputun
parent 8818faf189
commit c852ea4834
92 changed files with 1801 additions and 9819 deletions
+5
View File
@@ -1,5 +1,10 @@
# Changelog
## v5.0.5 (2021-10-27)
- History of changes: see https://github.com/go-chi/chi/compare/v5.0.4...v5.0.5
## v5.0.4 (2021-08-29)
- History of changes: see https://github.com/go-chi/chi/compare/v5.0.3...v5.0.4
+1 -1
View File
@@ -12,7 +12,7 @@ import (
func Heartbeat(endpoint string) func(http.Handler) http.Handler {
f := func(h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" && strings.EqualFold(r.URL.Path, endpoint) {
if (r.Method == "GET" || r.Method == "HEAD") && strings.EqualFold(r.URL.Path, endpoint) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
w.Write([]byte("."))
+6 -2
View File
@@ -7,6 +7,7 @@ import (
"bytes"
"errors"
"fmt"
"io"
"net/http"
"os"
"runtime/debug"
@@ -40,12 +41,15 @@ func Recoverer(next http.Handler) http.Handler {
return http.HandlerFunc(fn)
}
// for ability to test the PrintPrettyStack function
var recovererErrorWriter io.Writer = os.Stderr
func PrintPrettyStack(rvr interface{}) {
debugStack := debug.Stack()
s := prettyStack{}
out, err := s.parse(debugStack, rvr)
if err == nil {
os.Stderr.Write(out)
recovererErrorWriter.Write(out)
} else {
// print stdlib output as a fallback
os.Stderr.Write(debugStack)
@@ -72,7 +76,7 @@ func (s prettyStack) parse(debugStack []byte, rvr interface{}) ([]byte, error) {
// locate panic line, as we may have nested panics
for i := len(stack) - 1; i > 0; i-- {
lines = append(lines, stack[i])
if strings.HasPrefix(stack[i], "panic(0x") {
if strings.HasPrefix(stack[i], "panic(") {
lines = lines[0 : len(lines)-2] // remove boilerplate
break
}