mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 15:51:38 +00:00
* only write reponse body if not nil * update go samples * golang style convention
This commit is contained in:
committed by
GitHub
parent
09ff22230d
commit
612dc4dbcb
@@ -108,7 +108,11 @@ func EncodeJSONResponse(i interface{}, status *int,{{#addResponseHeaders}} heade
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
if i != nil {
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
|
||||
|
||||
@@ -76,7 +76,11 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string,
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
if i != nil {
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
|
||||
|
||||
@@ -72,7 +72,11 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string,
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
if i != nil {
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
|
||||
|
||||
@@ -72,7 +72,11 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string,
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
if i != nil {
|
||||
return json.NewEncoder(w).Encode(i)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
|
||||
|
||||
Reference in New Issue
Block a user