handle gzipped requests som more

This commit is contained in:
Kalle Carlbark 2024-08-20 13:40:51 +02:00
parent 9bcfa7a412
commit 2fb9853754
No known key found for this signature in database

View file

@ -23,10 +23,8 @@ func requestHandler(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Content-Encoding") == "gzip" {
gzipreader, _ := gzip.NewReader(r.Body)
requestbody, _ = io.ReadAll(gzipreader)
}
requestbody, err := io.ReadAll(r.Body)
if err != nil {
http.Error(w, "unable to read response", http.StatusBadRequest)
} else {
requestbody, _ = io.ReadAll(r.Body)
}
fmt.Printf("\n--- BODY ---\n%s\n", string(requestbody))
}