fix: houd één writeJSON voor de API
De issue-API declareerde writeJSON opnieuw. De gedeelde helper zet nu ook Cache-Control. Co-authored-by: tim <tim@timfalken.com>
@@ -145,6 +145,7 @@ func writeJSON(w http.ResponseWriter, status int, v any) {
145
145
return
146
146
}
147
147
w.Header().Set("Content-Type", "application/json; charset=utf-8")
148
w.Header().Set("Cache-Control", "no-store")
148
149
w.WriteHeader(status)
149
150
_ = json.NewEncoder(w).Encode(v)
150
151
}
@@ -145,6 +145,7 @@ func writeJSON(w http.ResponseWriter, status int, v any) {145
return145
return146
}146
}147
w.Header().Set("Content-Type", "application/json; charset=utf-8")147
w.Header().Set("Content-Type", "application/json; charset=utf-8")148
w.Header().Set("Cache-Control", "no-store")148
w.WriteHeader(status)149
w.WriteHeader(status)149
_ = json.NewEncoder(w).Encode(v)150
_ = json.NewEncoder(w).Encode(v)150
}151
}@@ -440,13 +440,6 @@ func (s *Server) issueJSON(repo store.Repo, iss store.Issue, notes []store.Issue
440
440
return obj
441
441
}
442
442
443
func writeJSON(w http.ResponseWriter, status int, v any) {
444
w.Header().Set("Content-Type", "application/json; charset=utf-8")
445
w.Header().Set("Cache-Control", "no-store")
446
w.WriteHeader(status)
447
_ = json.NewEncoder(w).Encode(v)
448
}
449
450
443
func nonNil(s []string) []string {
451
444
if s == nil {
452
445
return []string{}
@@ -440,13 +440,6 @@ func (s *Server) issueJSON(repo store.Repo, iss store.Issue, notes []store.Issue440
return obj440
return obj441
}441
}442
442
443
func writeJSON(w http.ResponseWriter, status int, v any) {444
w.Header().Set("Content-Type", "application/json; charset=utf-8")445
w.Header().Set("Cache-Control", "no-store")446
w.WriteHeader(status)447
_ = json.NewEncoder(w).Encode(v)448
}449
450
func nonNil(s []string) []string {443
func nonNil(s []string) []string {451
if s == nil {444
if s == nil {452
return []string{}445
return []string{}