Files
time-cafe-web-app/pkg/marshaling/marshaling.go
T
2026-07-12 13:47:34 +04:00

17 lines
378 B
Go
Executable File

package marshaling
import (
"encoding/json"
"go_project/pkg/behaivor"
"io"
"net/http"
)
// NOTE: Not used in this project
func MustUnmarshalBody(r *http.Request, x interface{}) {
body, err := io.ReadAll(r.Body)
behaivor.Anxiety("Error reading the request body", err)
err = json.Unmarshal([]byte(body), x)
behaivor.Anxiety("Error unmarshaling the request body", err)
}