Add debug printing

This commit is contained in:
Dakota Walsh 2026-01-20 11:06:17 +13:00
parent aab2e4e442
commit 1e71ce1c35

17
main.go
View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"net/http/httputil"
"os" "os"
"runtime/debug" "runtime/debug"
@ -105,9 +106,21 @@ func (app *application) routes() http.Handler {
return standard.Then(mux) return standard.Then(mux)
} }
func (app *application) stripe(w http.ResponseWriter, r *http.Request) {} func (app *application) stripe(w http.ResponseWriter, r *http.Request) {
res, err := httputil.DumpRequest(r, true)
if err != nil {
log.Fatal(err)
}
fmt.Print("Stripe:", string(res))
}
func (app *application) paypal(w http.ResponseWriter, r *http.Request) {} func (app *application) paypal(w http.ResponseWriter, r *http.Request) {
res, err := httputil.DumpRequest(r, true)
if err != nil {
log.Fatal(err)
}
fmt.Print("PayPal:", string(res))
}
// logRequest is a middleware that prints each request to the info log. // logRequest is a middleware that prints each request to the info log.
func (app *application) logRequest(next http.Handler) http.Handler { func (app *application) logRequest(next http.Handler) http.Handler {