Updating createMovieHandler using helper's readJSON method.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 52s

This commit is contained in:
Maxime Delporte
2025-10-24 14:47:20 +02:00
parent c6baa807e4
commit 12e1c7a523
2 changed files with 3 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ func (app *application) writeJSON(w http.ResponseWriter, status int, data envelo
}
func (app *application) readJSON(w http.ResponseWriter, r *http.Request, dst any) error {
// Decode the request body into the target destination.
// Initialize a new json.Decoder instance which reads from the request body, and then use the Decode() method to decode the body contents into the input struct.
err := json.NewDecoder(r.Body).Decode(dst)
if err != nil {
// If there is an error during decoding, start the triage...