package main
import (
"bytes"
"io/ioutil"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
defer r.Body.Close() // Goroutine için gövdeyi kapatmayı unutmayın
// String'e dönüştürür
bodyString := string(body)
w.Write([]byte(bodyString))
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}