Skip to content

Commit

Permalink
Edits
Browse files Browse the repository at this point in the history
  • Loading branch information
grellyd committed Aug 29, 2023
1 parent 2aa372f commit 12bf76b
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"html/template"
"image"
"image/png"
"io"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -55,31 +54,19 @@ func QRCode(w http.ResponseWriter, r *http.Request) {
}
globallogger.Info("in qrcode")
fmt.Printf("r.RequestURI: %v\n", r.RequestURI)
defer r.Body.Close()
body, err := io.ReadAll(r.Body)
if err != nil {
http.Error(w, fmt.Sprintf("failed to ReadAll: %s\n", err.Error()), http.StatusInternalServerError)
return
}
globallogger.Info(fmt.Sprintf("body: %s\n", string(body)))
// defer r.Body.Close()
// body, err := io.ReadAll(r.Body)
// if err != nil {
// http.Error(w, fmt.Sprintf("failed to ReadAll: %s\n", err.Error()), http.StatusInternalServerError)
// return
// }
// globallogger.Info(fmt.Sprintf("body: %s\n", string(body)))

if err := r.ParseForm(); err != nil {
http.Error(w, fmt.Sprintf("failed to parseForm: %s\n", err.Error()), http.StatusInternalServerError)
return
}

for k, v := range r.Header {
globallogger.Info(fmt.Sprintf("Header %s: %s\n", k, v))
}

for k, v := range r.Form {
globallogger.Info(fmt.Sprintf("Form %s: %s\n", k, v))
}

for k, v := range r.PostForm {
globallogger.Info(fmt.Sprintf("PostForm %s: %s\n", k, v))
}

link := r.PostFormValue("link")
globallogger.Info(fmt.Sprintf("link: %s\n", link))

Expand Down

0 comments on commit 12bf76b

Please sign in to comment.