mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
17 lines
336 B
Go
17 lines
336 B
Go
package app
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
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.Print(err)
|
|
}
|
|
}
|