ch4.2
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user