fix: set content-type to json

This commit is contained in:
2025-06-04 20:07:39 +02:00
parent e85b23b3e8
commit 7b8fe6baf2
5 changed files with 29 additions and 0 deletions

View File

@ -47,6 +47,8 @@ func (h *AdminHandler) GetUsers(w http.ResponseWriter, r *http.Request) {
encoder := json.NewEncoder(w)
w.Header().Set("Content-Type", "application/json")
if err := encoder.Encode(&Response{
Items: items,
Count: len(items),
@ -71,6 +73,8 @@ func (h *AdminHandler) GetUser(w http.ResponseWriter, r *http.Request) {
encoder := json.NewEncoder(w)
w.Header().Set("Content-Type", "application/json")
if err := encoder.Encode(NewUserDTO(&user)); err != nil {
web.Error(w, "failed to encode user dto", http.StatusInternalServerError)
}