示例#1
0
文件: charms.go 项目: jameinel/core
// manifestSender sends a JSON-encoded response to the client including the
// list of files contained in the charm bundle.
func (h *charmsHandler) manifestSender(w http.ResponseWriter, r *http.Request, bundle *charm.Bundle) {
	manifest, err := bundle.Manifest()
	if err != nil {
		http.Error(
			w, fmt.Sprintf("unable to read archive in %q: %v", bundle.Path, err),
			http.StatusInternalServerError)
		return
	}
	h.sendJSON(w, http.StatusOK, &params.CharmsResponse{Files: manifest.SortedValues()})
}