diff options
-rw-r--r-- | src/rest-api/cmd/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rest-api/cmd/main.go b/src/rest-api/cmd/main.go index af72f82..56cc6a3 100644 --- a/src/rest-api/cmd/main.go +++ b/src/rest-api/cmd/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "io" "net/http" ) @@ -12,5 +13,10 @@ func main() { } func handleRequest(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "Hello, World!", r.Body) + bytes, err := io.ReadAll(io.Reader(r.Body)) + if err != nil { + panic(err) + } + + fmt.Fprint(w, "Hello, World!", string(bytes)) } |