[fix] Fixed empty response
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Piotr Biernat 2022-04-21 23:35:49 +02:00
parent 4dab09e66b
commit 69b4179102
2 changed files with 3 additions and 4 deletions

View File

@ -12,9 +12,6 @@ func init() {
ErrLoadingEnvs = godotenv.Load()
}
func init() {
}
func GetEnv(name, defVal string) string {
env := os.Getenv(name)
if env == "" {

View File

@ -68,7 +68,9 @@ func encodeResponse(w http.ResponseWriter, res *response, err error) {
}
w.WriteHeader(res.Status)
json.NewEncoder(w).Encode(res.Data)
if res.Data != nil {
json.NewEncoder(w).Encode(res.Data)
}
}
func encodeError(w http.ResponseWriter, status int, e error) {