@@ -232,8 +232,8 @@ func CreateBlog(w http.ResponseWriter, r *http.Request) {
232
232
233
233
// ...save your blog...
234
234
235
- w.WriteHeader (http.StatusCreated )
236
235
w.Header ().Set (" Content-Type" , jsonapi.MediaType )
236
+ w.WriteHeader (http.StatusCreated )
237
237
238
238
if err := jsonapi.MarshalOnePayload (w, blog); err != nil {
239
239
http.Error (w, err.Error (), http.StatusInternalServerError )
@@ -288,8 +288,9 @@ func ListBlogs(w http.ResponseWriter, r *http.Request) {
288
288
// but, for now
289
289
blogs := testBlogsForList ()
290
290
291
- w.WriteHeader (http.StatusOK )
292
291
w.Header ().Set (" Content-Type" , jsonapi.MediaType )
292
+ w.WriteHeader (http.StatusOK )
293
+
293
294
if err := jsonapi.MarshalManyPayload (w, blogs); err != nil {
294
295
http.Error (w, err.Error (), http.StatusInternalServerError )
295
296
}
@@ -325,8 +326,9 @@ func CreateBlogs(w http.ResponseWriter, r *http.Request) {
325
326
// ...save each of your blogs
326
327
}
327
328
328
- w.WriteHeader (http.StatusCreated )
329
329
w.Header ().Set (" Content-Type" , jsonapi.MediaType )
330
+ w.WriteHeader (http.StatusCreated )
331
+
330
332
if err := jsonapi.MarshalManyPayload (w, blogs); err != nil {
331
333
http.Error (w, err.Error (), http.StatusInternalServerError )
332
334
}
0 commit comments