mirror of
https://github.com/go-acme/lego
synced 2026-03-16 15:35:49 +01:00
20 lines
433 B
Go
20 lines
433 B
Go
package servermock
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"net/http/httputil"
|
|
)
|
|
|
|
// DumpRequest logs the full HTTP request to the console, including the body if present.
|
|
func DumpRequest() http.HandlerFunc {
|
|
return func(rw http.ResponseWriter, req *http.Request) {
|
|
dump, err := httputil.DumpRequest(req, true)
|
|
if err != nil {
|
|
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
fmt.Println(string(dump))
|
|
}
|
|
}
|