@@ -232,8 +232,8 @@ func CreateBlog(w http.ResponseWriter, r *http.Request) {
232232
233233 // ...save your blog...
234234
235- w.WriteHeader (http.StatusCreated )
236235 w.Header ().Set (" Content-Type" , jsonapi.MediaType )
236+ w.WriteHeader (http.StatusCreated )
237237
238238 if err := jsonapi.MarshalOnePayload (w, blog); err != nil {
239239 http.Error (w, err.Error (), http.StatusInternalServerError )
@@ -288,8 +288,9 @@ func ListBlogs(w http.ResponseWriter, r *http.Request) {
288288 // but, for now
289289 blogs := testBlogsForList ()
290290
291- w.WriteHeader (http.StatusOK )
292291 w.Header ().Set (" Content-Type" , jsonapi.MediaType )
292+ w.WriteHeader (http.StatusOK )
293+
293294 if err := jsonapi.MarshalManyPayload (w, blogs); err != nil {
294295 http.Error (w, err.Error (), http.StatusInternalServerError )
295296 }
@@ -325,8 +326,9 @@ func CreateBlogs(w http.ResponseWriter, r *http.Request) {
325326 // ...save each of your blogs
326327 }
327328
328- w.WriteHeader (http.StatusCreated )
329329 w.Header ().Set (" Content-Type" , jsonapi.MediaType )
330+ w.WriteHeader (http.StatusCreated )
331+
330332 if err := jsonapi.MarshalManyPayload (w, blogs); err != nil {
331333 http.Error (w, err.Error (), http.StatusInternalServerError )
332334 }
0 commit comments