feat: handle binary content

This commit is contained in:
Max Richter
2025-10-04 12:31:40 +02:00
parent ab81c980b5
commit 74528625e3
3 changed files with 8 additions and 10 deletions

View File

@@ -3,6 +3,8 @@ package handler
import (
"encoding/json"
"net/http"
"git.max-richter.dev/max/marka/server-new/internal/adapters"
)
type ErrorResponse struct {
@@ -18,3 +20,8 @@ func writeJSON(w http.ResponseWriter, code int, v any) {
w.WriteHeader(code)
_ = json.NewEncoder(w).Encode(v)
}
func writeFile(w http.ResponseWriter, file *adapters.FsFile) {
w.Header().Set("Content-Type", file.Type)
w.Write(file.Content)
}