Initial commit
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user