handle gzipped requests som more
This commit is contained in:
parent
9bcfa7a412
commit
2fb9853754
1 changed files with 2 additions and 4 deletions
6
main.go
6
main.go
|
@ -23,10 +23,8 @@ func requestHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Header.Get("Content-Encoding") == "gzip" {
|
if r.Header.Get("Content-Encoding") == "gzip" {
|
||||||
gzipreader, _ := gzip.NewReader(r.Body)
|
gzipreader, _ := gzip.NewReader(r.Body)
|
||||||
requestbody, _ = io.ReadAll(gzipreader)
|
requestbody, _ = io.ReadAll(gzipreader)
|
||||||
}
|
} else {
|
||||||
requestbody, err := io.ReadAll(r.Body)
|
requestbody, _ = io.ReadAll(r.Body)
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "unable to read response", http.StatusBadRequest)
|
|
||||||
}
|
}
|
||||||
fmt.Printf("\n--- BODY ---\n%s\n", string(requestbody))
|
fmt.Printf("\n--- BODY ---\n%s\n", string(requestbody))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue