Files
weave-scope/app/server_helpers.go
2015-05-19 10:02:02 +00:00

14 lines
286 B
Go

package main
import (
"encoding/json"
"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)
json.NewEncoder(w).Encode(response)
}