mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 03:01:11 +00:00
18 lines
364 B
Go
18 lines
364 B
Go
package app
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
log "github.com/Sirupsen/logrus"
|
|
)
|
|
|
|
func respondWith(w http.ResponseWriter, code int, response interface{}) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Add("Cache-Control", "no-cache")
|
|
w.WriteHeader(code)
|
|
if err := json.NewEncoder(w).Encode(response); err != nil {
|
|
log.Error(err)
|
|
}
|
|
}
|