MCPcopy Index your code
hub / github.com/cortexproject/cortex / marshalAndSend

Function marshalAndSend

pkg/ruler/api.go:407–420  ·  view source on GitHub ↗
(output any, w http.ResponseWriter, logger log.Logger)

Source from the content-addressed store, hash-verified

405)
406
407func marshalAndSend(output any, w http.ResponseWriter, logger log.Logger) {
408 d, err := yaml.Marshal(&output)
409 if err != nil {
410 level.Error(logger).Log("msg", "error marshalling yaml rule groups", "err", err)
411 http.Error(w, err.Error(), http.StatusInternalServerError)
412 return
413 }
414
415 w.Header().Set("Content-Type", "application/yaml")
416 if _, err := w.Write(d); err != nil {
417 level.Error(logger).Log("msg", "error writing yaml response", "err", err)
418 return
419 }
420}
421
422func respondAccepted(w http.ResponseWriter, logger log.Logger) {
423 b, err := json.Marshal(&util_api.Response{

Callers 2

ListRulesMethod · 0.85
GetRuleGroupMethod · 0.85

Calls 6

SetMethod · 0.65
MarshalMethod · 0.45
LogMethod · 0.45
ErrorMethod · 0.45
HeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected