diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index dad6731..b83f9cd 100644 --- a/_examples/golang-basics/example.gen.go +++ b/_examples/golang-basics/example.gen.go @@ -224,6 +224,7 @@ func (s *exampleServiceServer) servePingJSON(ctx context.Context, w http.Respons w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) + w.Write([]byte("{}")) } func (s *exampleServiceServer) serveStatus(ctx context.Context, w http.ResponseWriter, r *http.Request) { diff --git a/_examples/golang-imports/api.gen.go b/_examples/golang-imports/api.gen.go index ef1583a..f4bf2ec 100644 --- a/_examples/golang-imports/api.gen.go +++ b/_examples/golang-imports/api.gen.go @@ -180,6 +180,7 @@ func (s *exampleAPIServer) servePingJSON(ctx context.Context, w http.ResponseWri w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) + w.Write([]byte("{}")) } func (s *exampleAPIServer) serveStatus(ctx context.Context, w http.ResponseWriter, r *http.Request) { diff --git a/server.go.tmpl b/server.go.tmpl index d6f1355..69e44b1 100644 --- a/server.go.tmpl +++ b/server.go.tmpl @@ -132,6 +132,8 @@ func (s *{{$serviceName}}) serve{{ .Name | firstLetterToUpper }}JSON(ctx context {{- if .Outputs | len}} w.Write(respBody) + {{- else }} + w.Write([]byte("{}")) {{- end}} } {{end}}