English/Japanese dictionary

I don't know how this worked before without encoding

+5
+5
internal/adapters/primary/http/response.go
··· 2 2 3 3 import ( 4 4 "dictionary-api/internal/core/ports" 5 + "encoding/json" 5 6 "net/http" 6 7 ) 7 8 ··· 18 19 func (rw *ResponseWriter) WriteJSON(w http.ResponseWriter, statusCode int, data any) { 19 20 w.Header().Set("Content-Type", "application/json") 20 21 w.WriteHeader(statusCode) 22 + 23 + if err := json.NewEncoder(w).Encode(data); err != nil { 24 + rw.logger.Error("could not encode JSON response: %v", err) 25 + } 21 26 } 22 27 23 28 func (rw *ResponseWriter) WriteJSONError(w http.ResponseWriter, statusCode int, message string) {