1 Commits

Author SHA1 Message Date
2f65441981 Enable benchHandler on "/bench/" in addition of "/bench"
Adding the trailing slash allows to trigger the bench handler for
performance measurements in situations where a trailing slash
character '/' is added to the request.

For example, in traefik addPrefix middleware, if you specify a
"/bench" prefix, a request on "http://localhost" will be transformed
from "GET /" to "GET /bench/" with no way to remove the trailing
'/' (at least without adding another rewrite rule, which would
modify measurements).
2021-04-27 15:39:57 +02:00

1
app.go
View File

@ -53,6 +53,7 @@ func main() {
http.HandleFunc("/data", dataHandler) http.HandleFunc("/data", dataHandler)
http.HandleFunc("/echo", echoHandler) http.HandleFunc("/echo", echoHandler)
http.HandleFunc("/bench", benchHandler) http.HandleFunc("/bench", benchHandler)
http.HandleFunc("/bench/", benchHandler)
http.HandleFunc("/", whoamiHandler) http.HandleFunc("/", whoamiHandler)
http.HandleFunc("/api", apiHandler) http.HandleFunc("/api", apiHandler)
http.HandleFunc("/health", healthHandler) http.HandleFunc("/health", healthHandler)