This commit is contained in:
lbenedar
2026-03-17 12:22:29 +03:00
parent 4694f0aa2f
commit 714295bc0d
3 changed files with 36 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
@@ -17,9 +16,9 @@ func (app *application) createMovieHandler(w http.ResponseWriter, r *http.Reques
Genres []string `json:"genres"`
}
err := json.NewDecoder(r.Body).Decode(&input)
err := app.readJSON(w, r, &input)
if err != nil {
app.errorResponse(w, r, http.StatusBadRequest, err.Error())
app.badRequestResponse(w, r, err)
return
}
fmt.Fprintf(w, "%+v\n", input)