(w http.ResponseWriter, status int, requestIdentity string, response any)
| 35 | } |
| 36 | |
| 37 | func (h APIHandler) respond(w http.ResponseWriter, status int, requestIdentity string, response any) { |
| 38 | w.Header().Set("Content-Type", "application/json") |
| 39 | if requestIdentity != "" { |
| 40 | w.Header().Set("X-Broker-API-Request-Identity", requestIdentity) |
| 41 | } |
| 42 | w.WriteHeader(status) |
| 43 | |
| 44 | encoder := json.NewEncoder(w) |
| 45 | encoder.SetEscapeHTML(false) |
| 46 | err := encoder.Encode(response) |
| 47 | if err != nil { |
| 48 | h.logger.Error("encoding response", err, slog.Int("status", status), slog.Any("response", response)) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | type brokerVersion struct { |
| 53 | Major int |
no test coverage detected