From 91710e28e6806f92f96211a775c24aa93b8ecd6a Mon Sep 17 00:00:00 2001 From: Baitinq Date: Wed, 1 May 2024 20:04:53 +0200 Subject: rest-api: return request body --- src/rest-api/cmd/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/rest-api') diff --git a/src/rest-api/cmd/main.go b/src/rest-api/cmd/main.go index bfeb752..af72f82 100644 --- a/src/rest-api/cmd/main.go +++ b/src/rest-api/cmd/main.go @@ -6,9 +6,11 @@ import ( ) func main() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "Hello, World!") - }) + http.HandleFunc("/", handleRequest) - http.ListenAndServe(":8080", nil) + http.ListenAndServe(":8080", nil) +} + +func handleRequest(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, "Hello, World!", r.Body) } -- cgit 1.4.1