Updating createMovieHandler using helper's readJSON method.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 52s
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 52s
This commit is contained in:
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user