Skip to content

Commit 53b9368

Browse files
committed
chore(golang): post/put/delete return 204 status now
Part of #9
1 parent 2c90e21 commit 53b9368

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/go/routes.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ func registerRoutes(r chi.Router) {
1818
})
1919

2020
r.Post("/v1/categories", func(w http.ResponseWriter, _ *http.Request) {
21-
w.Write([]byte("TODO"))
21+
w.WriteHeader(http.StatusNoContent)
2222
})
2323

2424
r.Get("/v1/categories/{categoryId}", func(w http.ResponseWriter, _ *http.Request) {
2525
w.Write([]byte("TODO"))
2626
})
2727

2828
r.Put("/v1/categories/{categoryId}", func(w http.ResponseWriter, _ *http.Request) {
29-
w.Write([]byte("TODO"))
29+
w.WriteHeader(http.StatusNoContent)
3030
})
3131

3232
r.Delete("/v1/categories/{categoryId}", func(w http.ResponseWriter, _ *http.Request) {
33-
w.Write([]byte("TODO"))
33+
w.WriteHeader(http.StatusNoContent)
3434
})
3535

3636
}

src/templates/routes.go.ejs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ endpoints.forEach(function(endpoint) {
1717
if (endpoint.hasOwnProperty('post')) {
1818
%>
1919
r.Post("<%- path %>", func(w http.ResponseWriter, _ *http.Request) {
20-
w.Write([]byte("TODO"))
20+
w.WriteHeader(http.StatusNoContent)
2121
})
2222
<%
2323
}
2424
if (endpoint.hasOwnProperty('put')) {
2525
%>
2626
r.Put("<%- path %>", func(w http.ResponseWriter, _ *http.Request) {
27-
w.Write([]byte("TODO"))
27+
w.WriteHeader(http.StatusNoContent)
2828
})
2929
<%
3030
}
3131
if (endpoint.hasOwnProperty('delete')) {
3232
%>
3333
r.Delete("<%- path %>", func(w http.ResponseWriter, _ *http.Request) {
34-
w.Write([]byte("TODO"))
34+
w.WriteHeader(http.StatusNoContent)
3535
})
3636
<%
3737
}

0 commit comments

Comments
 (0)